queue

package
v0.0.0-...-3113787 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deduplicator

type Deduplicator struct {
	// contains filtered or unexported fields
}

Deduplicator() keeps track of the previously run requests to avoid re-running them.

func (*Deduplicator) Next

func (d *Deduplicator) Next() *Request

type DoneCallback

type DoneCallback func(*Request, *Result) bool

type DynamicOrderer

type DynamicOrderer struct {
	// contains filtered or unexported fields
}

func DynamicOrder

func DynamicOrder() *DynamicOrderer

DynamicOrder() can be used to form nested queues dynamically. That is, if q1 := pq.Append() q2 := pq.Append() All elements added via q2.Submit() will always have a *lower* priority than all elements added via q1.Submit().

func (*DynamicOrderer) Append

func (do *DynamicOrderer) Append() Executor

func (*DynamicOrderer) Next

func (do *DynamicOrderer) Next() *Request

type DynamicSourceCtl

type DynamicSourceCtl struct {
	// contains filtered or unexported fields
}

func DynamicSource

func DynamicSource(source Source) *DynamicSourceCtl

DynamicSource is assumed never to point to nil.

func (*DynamicSourceCtl) Next

func (ds *DynamicSourceCtl) Next() *Request

func (*DynamicSourceCtl) Store

func (ds *DynamicSourceCtl) Store(source Source)

type Executor

type Executor interface {
	Submit(req *Request)
}

Executor describes the interface wanted by the producers of requests. After a Request is submitted, it's expected that the consumer will eventually take it and report the execution result via Done().

type PlainQueue

type PlainQueue struct {
	// contains filtered or unexported fields
}

PlainQueue is a straighforward thread-safe Request queue implementation.

func Plain

func Plain() *PlainQueue

func PlainWithStat

func PlainWithStat(val *stats.Val) *PlainQueue

func (*PlainQueue) Len

func (pq *PlainQueue) Len() int

func (*PlainQueue) Next

func (pq *PlainQueue) Next() *Request

func (*PlainQueue) Submit

func (pq *PlainQueue) Submit(req *Request)

type Request

type Request struct {
	Prog     *prog.Prog
	ExecOpts flatrpc.ExecOpts

	// If specified, the resulting signal for call SignalFilterCall
	// will include subset of it even if it's not new.
	SignalFilter     signal.Signal
	SignalFilterCall int

	// By default, only the newly seen signal is returned.
	// ReturnAllSignal tells the executor to return everything.
	ReturnAllSignal bool
	ReturnError     bool
	ReturnOutput    bool

	// This stat will be incremented on request completion.
	Stat *stats.Val

	// Options needed by runtest.
	BinaryFile string // If set, it's executed instead of Prog.
	Repeat     int    // Repeats in addition to the first run.

	// Important requests will be retried even from crashed VMs.
	Important bool
	// contains filtered or unexported fields
}

func (*Request) Done

func (r *Request) Done(res *Result)

func (*Request) OnDone

func (r *Request) OnDone(cb DoneCallback)

func (*Request) Risky

func (r *Request) Risky() bool

Risky() returns true if there's a substantial risk of the input crashing the VM.

func (*Request) Validate

func (r *Request) Validate() error

func (*Request) Wait

func (r *Request) Wait(ctx context.Context) *Result

Wait() blocks until we have the result.

type Result

type Result struct {
	Info   *flatrpc.ProgInfo
	Output []byte
	Status Status
	Err    error // More details in case of ExecFailure.
}

func (*Result) Stop

func (r *Result) Stop() bool

type Source

type Source interface {
	Next() *Request
}

Source describes the interface wanted by the consumers of requests.

func Alternate

func Alternate(base Source, nth int) Source

Alternate proxies base, but returns nil every nth Next() call.

func Callback

func Callback(cb func() *Request) Source

Callback produces a source that calls the callback to serve every Next() request.

func Deduplicate

func Deduplicate(ctx context.Context, source Source) Source

func Order

func Order(sources ...Source) Source

func Retry

func Retry(base Source) Source

Retry adds a layer that resends results with Status=Restarted.

type Status

type Status int
const (
	Success     Status = iota
	ExecFailure        // For e.g. serialization errors.
	Crashed            // The VM crashed holding the request.
	Restarted          // The VM was restarted holding the request.
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL