dispatcher

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const EventCall = "__EventCall"

Variables

View Source
var (
	ErrorIsClosed = errors.New("closed")
)

Functions

This section is empty.

Types

type CallBackFunc

type CallBackFunc func(e IEvent) error

func (CallBackFunc) DataEvent

func (f CallBackFunc) DataEvent(e IEvent) error

type CallBackHandler

type CallBackHandler interface {
	DataEvent(e IEvent) error
}

type Data

type Data struct {
	// contains filtered or unexported fields
}

func NewMyData

func NewMyData(data map[string]map[string][]byte) *Data

func (*Data) DoEvent

func (d *Data) DoEvent(event IEvent)

func (*Data) GET

func (d *Data) GET() map[string]map[string][]byte

func (*Data) GetNamespace

func (d *Data) GetNamespace(namespace string) (map[string][]byte, bool)

type DataDispatchCenter

type DataDispatchCenter struct {
	// contains filtered or unexported fields
}

DataDispatchCenter 数据广播中心

func (*DataDispatchCenter) Close

func (d *DataDispatchCenter) Close() error

func (*DataDispatchCenter) Listener

func (d *DataDispatchCenter) Listener() IListener

func (*DataDispatchCenter) Register

func (d *DataDispatchCenter) Register(handlerFunc CallBackFunc) (closeChan chan<- int)

func (*DataDispatchCenter) Send

func (d *DataDispatchCenter) Send(e IEvent)

type IDispatchCenter

type IDispatchCenter interface {
	io.Closer
	Register(handler CallBackFunc) (closeChan chan<- int)
	Listener() IListener
	Send(e IEvent)
}

func NewDataDispatchCenter

func NewDataDispatchCenter() IDispatchCenter

func NewEventDispatchCenter

func NewEventDispatchCenter() IDispatchCenter

type IEvent

type IEvent interface {
	Namespace() string
	Event() string
	Key() string
	Data() []byte
	All() map[string]map[string][]byte
}

type IListener

type IListener interface {
	Leave()
	Event() <-chan IEvent
}

type InitEvent

type InitEvent map[string]map[string][]byte

func (InitEvent) All

func (r InitEvent) All() map[string]map[string][]byte

func (InitEvent) Data

func (r InitEvent) Data() []byte

func (InitEvent) Event

func (r InitEvent) Event() string

func (InitEvent) Key

func (r InitEvent) Key() string

func (InitEvent) Namespace

func (r InitEvent) Namespace() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL