Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = fmt.Errorf("not found") ErrNilWorker = fmt.Errorf("nil worker") ErrNoWorkerID = fmt.Errorf("no worker id") ErrNoWorkerType = fmt.Errorf("no worker type") ErrInvalidWorkerType = fmt.Errorf("invalid worker type") ErrNoCreatedTime = fmt.Errorf("no created time") ErrMarshal = fmt.Errorf("cannot marshal") )
Functions ¶
This section is empty.
Types ¶
type HeartbeatDetector ¶
type LogicTask ¶
type LogicTask interface { GetLogicID() LogicTaskID GetData() []byte }
LogicTask is the logic task for worker to process.
func NewLogicTask ¶
func NewLogicTask(logicID LogicTaskID, data []byte) LogicTask
type LogicTaskID ¶
type LogicTaskID string
func (LogicTaskID) String ¶
func (id LogicTaskID) String() string
type OpFunc ¶
type OpFunc func(*defaultWorker)
func WithHandler ¶
func WithHandler(h handler) OpFunc
type Worker ¶
type Worker interface { consistent.Member json.Marshaler json.Unmarshaler HeartbeatDetector GetID() ID GetType() Type SetType(typ Type) GetCreatedAt() time.Time Handle(ctx context.Context, task LogicTask) }
Worker .
func NewFromBytes ¶
Click to show internal directories.
Click to hide internal directories.