Documentation ¶
Index ¶
- Constants
- Variables
- type Delegate
- type Option
- type Proc
- type ProcChan
- type Q
- func (a *Q) Add(req interface{}) error
- func (a *Q) AddAnyway(req interface{}, ts time.Duration) error
- func (a *Q) AddPrior(req interface{}) error
- func (a *Q) Close()
- func (a *Q) IsClosed() bool
- func (a *Q) Pop() (interface{}, error)
- func (a *Q) PopAnyway() (interface{}, error)
- func (a *Q) Size() int
- type RunnerQ
- func (c *RunnerQ) AsyncCall(fn interface{}, ctx context.Context, arg interface{}) (interface{}, error)
- func (c *RunnerQ) AsyncDelegate(ctx context.Context, delegate Delegate) (interface{}, error)
- func (c *RunnerQ) AsyncProc(ctx context.Context, proc Proc) (interface{}, error)
- func (c *RunnerQ) Run()
- func (c *RunnerQ) Size() int
- func (c *RunnerQ) Stop()
- func (c *RunnerQ) WaitStop()
Constants ¶
View Source
const (
//DefaultQSize default runner queue size
DefaultQSize = 1024 * 8
)
Variables ¶
View Source
var ( //ErrClosed -- msg queue closed ErrClosed = status.Error(codes.Unavailable, "async.queue.closed") //ErrFull -- msg queue is full ErrFull = status.Error(codes.ResourceExhausted, "async.queue.full") //ErrSync it should never gonna happen ErrSync = status.Error(codes.OutOfRange, "async.never.gonna.happen.crazy") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(option *optionT)
Option : only qSize option
func WithWaitGroup ¶
WithWaitGroup : setup outside wait group controller If this value be set, the wait group will be increase when runner loop go routine exits.
type ProcChan ¶
type ProcChan struct {
// contains filtered or unexported fields
}
ProcChan : async proc chan
type Q ¶
type Q struct {
// contains filtered or unexported fields
}
Q actor queue structure define
func NewQ ¶
NewQ new queue size: queue size, if set 0, it means that no limitation of size, it's an infinity queue.
func (*Q) AddAnyway ¶
AddAnyway add normal request to the normal queue end place anyway if queue full, sleep then try
type RunnerQ ¶
type RunnerQ struct {
// contains filtered or unexported fields
}
RunnerQ : async runner
func (*RunnerQ) AsyncCall ¶
func (c *RunnerQ) AsyncCall(fn interface{}, ctx context.Context, arg interface{}) (interface{}, error)
AsyncCall : async call ctx -- context.Context callCtxT -- call context
func (*RunnerQ) AsyncDelegate ¶
AsyncDelegate : async delegate ctx -- context.Context delegate -- delegate function
Click to show internal directories.
Click to hide internal directories.