seq

package
v0.0.0-...-f3d8a94 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Eaborted = errors.New("sequence aborted")

Functions

This section is empty.

Types

type AbortReq

type AbortReq struct {
}

AbortReq is always replied to with an error.

func (AbortReq) Ttype

func (AbortReq) Ttype() interface{}

type BasicReq

type BasicReq interface {
	Req
	// contains filtered or unexported methods
}

type CloneReq

type CloneReq struct {
	F File
}

func (CloneReq) Ttype

func (CloneReq) Ttype() interface{}

type CloneResult

type CloneResult struct{}

func (CloneResult) Rtype

func (CloneResult) Rtype() interface{}

type ClunkReq

type ClunkReq struct{}

func (ClunkReq) Ttype

func (ClunkReq) Ttype() interface{}

type ClunkResult

type ClunkResult struct{}

func (ClunkResult) Rtype

func (ClunkResult) Rtype() interface{}

type CompositeReq

type CompositeReq interface {
	Req
	Do(seq *Sequencer, f File) error // executes action. must result in one result.
}

type CreateReq

type CreateReq struct {
	Name string
	Perm plan9.Perm
	Mode uint8
}

func (CreateReq) Ttype

func (CreateReq) Ttype() interface{}

type CreateResult

type CreateResult struct {
	Q plan9.Qid
}

func (CreateResult) Rtype

func (CreateResult) Rtype() interface{}

type File

type File interface {
	Do(op BasicReq) (Result, error)
	IsOpen() bool
	IsDir() bool
	IsInSequence() bool
	FileSys() FileSys
}

type FileSys

type FileSys interface {
	NewFile() (File, error)
	StartSequence() (Sequence, <-chan Result, error)
}

type NonseqReq

type NonseqReq struct {
}

func (NonseqReq) Ttype

func (NonseqReq) Ttype() interface{}

type NonseqResult

type NonseqResult struct {
}

func (NonseqResult) Rtype

func (NonseqResult) Rtype() interface{}

type OpenReq

type OpenReq struct {
	Mode uint8
}

func (OpenReq) Ttype

func (OpenReq) Ttype() interface{}

type OpenResult

type OpenResult struct {
	Q plan9.Qid
}

func (OpenResult) Rtype

func (OpenResult) Rtype() interface{}

type ReadReq

type ReadReq struct {
	Data   []byte
	Offset int64
}

func (ReadReq) Ttype

func (ReadReq) Ttype() interface{}

type ReadResult

type ReadResult struct {
	Count int
}

func (ReadResult) Rtype

func (ReadResult) Rtype() interface{}

type RemoveReq

type RemoveReq struct {
}

func (RemoveReq) Ttype

func (RemoveReq) Ttype() interface{}

type RemoveResult

type RemoveResult struct {
}

func (RemoveResult) Rtype

func (RemoveResult) Rtype() interface{}

type Req

type Req interface {
	Ttype() interface{}
}

type Result

type Result interface {
	Rtype() interface{}
}

type Sequence

type Sequence interface {
	Do(f File, op BasicReq) error
	FileSys() FileSys
	Error() error
}

type Sequencer

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

func NewSequencer

func NewSequencer() (*Sequencer, <-chan Result)

NewSequencer returns a new object that represents a stream of requests. The caller should arrange to receive the result of each request in turn on result. If one request fails, then all subsequent requests will fail - if this happens, the result channel will be closed early, and the error will be available from seq.Error(). Within a given Sequence, calls to Do and Subsequence

func (*Sequencer) Do

func (seq *Sequencer) Do(f File, anyReq Req) (err error)

Do adds the given request to the queue of requests on seq. It returns an error if it could not do so.

func (*Sequencer) Error

func (seq *Sequencer) Error() error

Error returns any error that has occurred when executing the sequence. The returned value is only valid when the Sequencer's result channel has been closed.

func (*Sequencer) Result

func (seq *Sequencer) Result(val Result, err error)

When a Sequencer's result channel has been closed, Result must be called to provide the results of the sequence to its parent. If err is nil, val will be sent on the parent's result channel; otherwise the parent's result channel will be closed and err returned from its Error(). It is an error for err to be non nil if the sequence has not terminated with an error.

func (*Sequencer) Subsequencer

func (parent *Sequencer) Subsequencer(name string) (seq *Sequencer, result <-chan Result)

Subsequencer returns a Sequencer that is nested within parent. No requests on parent will take place until all requests on seq have been sent (this allows a subsequence to send requests in a separate goroutine without needing explicit synchronisation to ensure sequentiality). It behaves just as a Sequencer, except that after result has been closed, seq.Result must be called to provide the sub-sequencer's result.

func (*Sequencer) Wait

func (seq *Sequencer) Wait() (err error)

Wait blocks until the root Sequencer has terminated.

type StatReq

type StatReq struct{}

func (StatReq) Ttype

func (StatReq) Ttype() interface{}

type StatResult

type StatResult struct {
	Stat plan9.Dir
}

func (StatResult) Rtype

func (StatResult) Rtype() interface{}

type StringResult

type StringResult string

func (StringResult) Rtype

func (StringResult) Rtype() interface{}

type WalkReq

type WalkReq struct {
	Name string
}

func (WalkReq) Ttype

func (WalkReq) Ttype() interface{}

type WalkResult

type WalkResult struct {
	Q plan9.Qid
}

func (WalkResult) Rtype

func (WalkResult) Rtype() interface{}

type WriteReq

type WriteReq struct {
	Data   []byte
	Offset int64
}

func (WriteReq) Ttype

func (WriteReq) Ttype() interface{}

type WriteResult

type WriteResult struct {
	Count int
}

func (WriteResult) Rtype

func (WriteResult) Rtype() interface{}

type WstatReq

type WstatReq struct {
	Stat plan9.Dir
}

func (WstatReq) Ttype

func (WstatReq) Ttype() interface{}

type WstatResult

type WstatResult struct{}

func (WstatResult) Rtype

func (WstatResult) Rtype() interface{}

Jump to

Keyboard shortcuts

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