forked from p53841790/wheat-cache
32 lines
590 B
Go
32 lines
590 B
Go
package event
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type eventType int8
|
|
|
|
const (
|
|
defaultEventState = eventType(iota) //默认情况下的状态
|
|
waitEventState // 等待状态
|
|
workEventState //工作状态
|
|
closeEventState //事件关闭状态
|
|
)
|
|
|
|
type EventWorkFunc func() (interface{}, error)
|
|
|
|
type DriverInterface interface {
|
|
Get() *Event
|
|
Put(event *Event)
|
|
GetLengthJudge() bool
|
|
}
|
|
|
|
type ProduceInterface interface {
|
|
Call(ctx context.Context, event *Event)
|
|
}
|
|
|
|
type ConsumerInterface interface {
|
|
Receive(ctx context.Context) *Event
|
|
}
|
|
|