Documentation ¶
Index ¶
- Variables
- type EventBus
- type MemoryEventBus
- func (eb *MemoryEventBus) Publish(topic string, data interface{}) error
- func (eb *MemoryEventBus) Subscribe(topic string, handler interface{}) error
- func (eb *MemoryEventBus) TryLock(key string) error
- func (eb *MemoryEventBus) UnLock(key string) error
- func (eb *MemoryEventBus) UnSubscribe(topic string, handler interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAlreadyLocked = errors.New("already locked")
)
Functions ¶
This section is empty.
Types ¶
type EventBus ¶
type EventBus interface { // Subscribe subscribe event Subscribe(topic string, handler interface{}) error // UnSubscribe unsubscribe event UnSubscribe(topic string, handler interface{}) error // Publish publish event Publish(topic string, data interface{}) error // TryLock try lock, if lock success return nil TryLock(key string) error // UnLock unLock UnLock(key string) error }
func GetEventBus ¶
func GetEventBus() EventBus
func NewEventBus ¶
type MemoryEventBus ¶
type MemoryEventBus struct {
// contains filtered or unexported fields
}
func NewMemoryEventBus ¶
func NewMemoryEventBus() *MemoryEventBus
func (*MemoryEventBus) Publish ¶
func (eb *MemoryEventBus) Publish(topic string, data interface{}) error
func (*MemoryEventBus) Subscribe ¶
func (eb *MemoryEventBus) Subscribe(topic string, handler interface{}) error
func (*MemoryEventBus) TryLock ¶
func (eb *MemoryEventBus) TryLock(key string) error
func (*MemoryEventBus) UnLock ¶
func (eb *MemoryEventBus) UnLock(key string) error
func (*MemoryEventBus) UnSubscribe ¶
func (eb *MemoryEventBus) UnSubscribe(topic string, handler interface{}) error
Click to show internal directories.
Click to hide internal directories.