wheat-cache/pkg/event/define.go

37 lines
696 B
Go
Raw Normal View History

2021-09-23 11:05:51 +08:00
package event
import (
"context"
)
type eventType int8
const (
2021-09-28 20:55:09 +08:00
defaultEventState = eventType(iota) //默认情况下的状态
waitEventState // 等待状态
workEventState //工作状态
closeEventState //事件关闭状态
2021-09-23 11:05:51 +08:00
)
2021-09-28 20:55:09 +08:00
type EventWorkFunc func() (interface{}, error)
2021-09-23 11:05:51 +08:00
type DriverInterface interface {
2021-10-26 09:29:39 +08:00
Get() *event
Put(*event)
GetLength() int
2021-10-26 09:29:39 +08:00
NewEvent(string) *event
Recovery(*event)
2021-09-23 11:05:51 +08:00
}
type ProduceInterface interface {
2021-10-26 09:29:39 +08:00
Call(context.Context, *event)
NewEvent(string) *event
Recovery(*event)
2021-09-23 11:05:51 +08:00
}
type ConsumerInterface interface {
2021-10-26 09:29:39 +08:00
Receive(ctx context.Context) *event
NewEvent(string) *event
Recovery(*event)
2021-09-23 11:05:51 +08:00
}