space

package
v0.0.0-...-e36e409 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attribute

func Attribute(r Host) *sync.Map

func Do

func Do(r Host, f func())

func DoAndWait

func DoAndWait(r Host, f func())

func Done

func Done(r Host)

func SendMessage

func SendMessage(r Host, event Message)

Types

type Action

type Action struct {
	Func func()
	Done chan<- bool
}

type Host

type Host interface {
	EventHostId() string
}

type Message

type Message struct {
	From       int // user id
	To         int `json:"-"` // user id, -1 means all
	Topic      string
	Attributes map[string]interface{}
	Payload    interface{}
}

type Publisher

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

func Publish

func Publish(r Host) Publisher

func (Publisher) Attribute

func (p Publisher) Attribute() *sync.Map

func (Publisher) Do

func (p Publisher) Do(f func())

func (Publisher) DoAndWait

func (p Publisher) DoAndWait(f func())

func (Publisher) Done

func (p Publisher) Done()

func (Publisher) Listen

func (p Publisher) Listen() Subscription

func (Publisher) SendEvent

func (p Publisher) SendEvent(message Message)

type Subscriber

type Subscriber struct {
	MessageListener chan<- Message
	Done            <-chan bool
}

type Subscription

type Subscription struct {
	MessageListener <-chan Message
	Done            chan<- bool
}

func Listen

func Listen(r Host) Subscription

type Thread

type Thread struct {
	EventStream chan interface{} // Message or Action or Subscriber
	Done        chan bool
	Attribute   sync.Map
}

Jump to

Keyboard shortcuts

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