Documentation ¶
Index ¶
- Variables
- type MQ
- func (a *MQ) AddCtrl(cmd interface{}) error
- func (a *MQ) AddCtrlAnyway(cmd interface{}, ts time.Duration) error
- func (a *MQ) AddPriorCtrl(cmd interface{}) error
- func (a *MQ) AddPriorReq(req interface{}) error
- func (a *MQ) AddReq(req interface{}) error
- func (a *MQ) AddReqAnyway(req interface{}, ts time.Duration) error
- func (a *MQ) Close()
- func (a *MQ) IsCleared() bool
- func (a *MQ) IsClosed() bool
- func (a *MQ) Pop() (interface{}, error)
- func (a *MQ) PopAnyway() (interface{}, error)
- func (a *MQ) TryClear() bool
- func (a *MQ) TryClose() bool
- func (a *MQ) WaitClear(ctx context.Context) error
- func (a *MQ) WaitClose(ctx context.Context) error
- type Option
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type MQ ¶
type MQ struct {
// contains filtered or unexported fields
}
MQ actor queue structure define
func (*MQ) AddCtrlAnyway ¶
AddCtrlAnyway dd control request to the control queue end place anyway if queue full, sleep then try
func (*MQ) AddPriorCtrl ¶
AddPriorCtrl add control request to the control queue first place.
func (*MQ) AddPriorReq ¶
AddPriorReq add normal request to the normal queue first place.
func (*MQ) AddReqAnyway ¶
AddReqAnyway add normal request to the normal queue end place anyway if queue full, sleep then try
func (*MQ) PopAnyway ¶
PopAnyway consume an item like Pop, but it can consume even the queue is closed.
func (*MQ) TryClear ¶
TryClear try to clear a queue. the function should be called by consumer. if the queue be set can pop even after closed. the consumer handle the last pop item, it can call the function. after the function be called, which means the queue is totally clear. no producer/no consumer anymore
func (*MQ) TryClose ¶
TryClose try to close a queue in case it's empty. otherwise, the queue can not be closed.
type Option ¶
type Option func(o *_Option)
Option : option function
func WithQCtrlSize ¶
WithQCtrlSize setup max queue number of control queue if max is 0, which means no limit
func WithQReqSize ¶
WithQReqSize setup max queue number of request queue if max is 0, which means no limit