Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSimpleDatapack ¶
func NewSimpleDatapack(ctx context.Context, r io.ReadCloser) *simpleDatapack
Types ¶
type Datapack ¶
type Datapack interface { Context() context.Context ReadCloser() io.ReadCloser }
Datapack is a io.ReadCloser with some extra info.
type DatapackProducer ¶
type ErrorPasser ¶
type ErrorPasser struct {
// contains filtered or unexported fields
}
func NewClosedErrorPasser ¶
func NewClosedErrorPasser(errs ...error) *ErrorPasser
func NewErrorPasser ¶
func NewErrorPasser() *ErrorPasser
func NewErrorPasserWithCap ¶
func NewErrorPasserWithCap(maxErrCnt int) *ErrorPasser
func (*ErrorPasser) Cap ¶
func (e *ErrorPasser) Cap() int
func (*ErrorPasser) Check ¶
func (e *ErrorPasser) Check() (err error, done bool)
Check try get err in a non-block way. NOTE: if done, err is nil.
func (*ErrorPasser) Close ¶
func (e *ErrorPasser) Close()
func (*ErrorPasser) Get ¶
func (e *ErrorPasser) Get() error
func (*ErrorPasser) Put ¶
func (e *ErrorPasser) Put(err error)
type IOStream ¶
type IOStream struct {
// contains filtered or unexported fields
}
IOStream is a stream of Datapack.
func NewClosedIOStream ¶
func NewIOStream ¶
func NewIOStream() *IOStream
func NewIOStreamWithCap ¶
type Processor ¶
type Processor func(inputStream *IOStream, inputErr *ErrorPasser) (outputStream *IOStream, outputErr *ErrorPasser)
Processor is a function which handles input stream and send result into output stream. WARN: inputStream / inputErr should be closed by the previous Processor, while outputStream / outputErr should be closed by the current one.
func BuildProcChain ¶
type SafeIOStreamHandler ¶
type SafeIOStreamHandler struct {
// contains filtered or unexported fields
}
func NewSafeIOStreamHandler ¶
func NewSafeIOStreamHandler( inputStream *IOStream, inputErr *ErrorPasser, handler func(context.Context, io.ReadCloser) error, finalizer func(), ) *SafeIOStreamHandler
func (*SafeIOStreamHandler) BuildStream ¶
func (s *SafeIOStreamHandler) BuildStream() (*IOStream, *ErrorPasser)
func (*SafeIOStreamHandler) Start ¶
func (s *SafeIOStreamHandler) Start()
type SafeIOStreamWriter ¶
type SafeIOStreamWriter struct {
// contains filtered or unexported fields
}
func NewSafeIOStreamWriter ¶
func NewSafeIOStreamWriter(p DatapackProducer) *SafeIOStreamWriter
func (*SafeIOStreamWriter) Start ¶
func (s *SafeIOStreamWriter) Start() (*IOStream, *ErrorPasser)
Click to show internal directories.
Click to hide internal directories.