Documentation ¶
Index ¶
- Constants
- Variables
- func UUIDStringGen() (string, error)
- type AsyncExecutor
- type Closer
- type Executor
- type FanInAsyncExecutor
- type FanInExecutor
- type FanOutAsyncExecutor
- type FanOutExecutor
- type Handler
- type IterateCloser
- type Iterator
- type OffsetWriter
- type StaticBuffer
- func (sb *StaticBuffer) Cap() int64
- func (sb *StaticBuffer) Close() error
- func (sb *StaticBuffer) Read(p []byte) (int, error)
- func (sb *StaticBuffer) ReadFrom(r io.Reader) (int64, error)
- func (sb *StaticBuffer) Reset()
- func (sb *StaticBuffer) Size() int64
- func (sb *StaticBuffer) Write(p []byte) (int, error)
- func (sb *StaticBuffer) WriteTo(w io.Writer) (int64, error)
- type UUID
Constants ¶
const (
DefaultChannelSize = 10
)
Variables ¶
var ( ErrNegativeRead = errors.New("util.StaticBuffer: reader returned negative count from Read") ErrInvalidWrite = errors.New("util.StaticBuffer: writer returned invalid count from Write") ErrNotEnoughSpace = errors.New("util.StaticBuffer: not enough space left for writting") )
var ( ErrInvalidUUIDString = errors.New("invalid uuid string format") InvalidUUID = UUID{0} )
var (
ErrIteratorEOF = errors.New("Iterator reaches EOF")
)
Functions ¶
func UUIDStringGen ¶
Types ¶
type AsyncExecutor ¶
type AsyncExecutor struct {
// contains filtered or unexported fields
}
AsyncExecutor deal with a bunch of input data Buf make sure that those input data belongs to the same Request Because only one context associated with the Executor And there's supposed to be only one context bound to one Request
func NewAsyncExecutor ¶
func NewAsyncExecutor(h Handler) *AsyncExecutor
type FanInAsyncExecutor ¶
type FanInAsyncExecutor struct {
// contains filtered or unexported fields
}
FanInExecutor is a converge executor , In charge of merging multiple channels' output into one single channel
func NewFanInAsyncExecutor ¶
func NewFanInAsyncExecutor(h Handler) *FanInAsyncExecutor
type FanInExecutor ¶
type FanOutAsyncExecutor ¶
type FanOutAsyncExecutor struct { }
FanOutExecutor expand the data processing of one intput channel to multiple executor Notice that the caller should handle the output channel slice
func NewFanOutAsyncExecutor ¶
func NewFanOutAsyncExecutor() *FanOutAsyncExecutor
type FanOutExecutor ¶
type Handler ¶
type Handler interface { Init() error Handle(ctx context.Context, d interface{}) (interface{}, error) Finish() error }
The interface for handling request
type IterateCloser ¶
If the iterator needs some cleanning work when done this could be the choice
type Iterator ¶
This could be the result of a handler if th handler intends to generate a collection of data. When the iteration done, return EOF error
type OffsetWriter ¶
func NewOffsetWriter ¶
func NewOffsetWriter(wa io.WriterAt, offset int64) *OffsetWriter
type StaticBuffer ¶
type StaticBuffer struct { Buf []byte // buffer W int64 // start point of writting R int64 // start point of reading }
func NewStaticBuffer ¶
func NewStaticBuffer(cap int64) *StaticBuffer
func (*StaticBuffer) Cap ¶
func (sb *StaticBuffer) Cap() int64
func (*StaticBuffer) Close ¶
func (sb *StaticBuffer) Close() error
func (*StaticBuffer) Reset ¶
func (sb *StaticBuffer) Reset()
func (*StaticBuffer) Size ¶
func (sb *StaticBuffer) Size() int64