tools

package
v0.0.0-...-e652847 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorMap

type ActorMap struct {
	Events chan ActorState
	// contains filtered or unexported fields
}

ActorMap holds a map of actors->status and keep it in sync by subscribing to actor events

func NewActorMap

func NewActorMap(ctx context.Context, client *api.Client, log xbus.Logger) (*ActorMap, error)

NewActorMap initialize the map and starts listening

func (*ActorMap) Close

func (am *ActorMap) Close()

Close stops the sync

func (*ActorMap) IsOnline

func (am *ActorMap) IsOnline(id api.UUID) (bool, bool)

IsOnline returns the status of an actor

func (*ActorMap) List

func (am *ActorMap) List() (list []ActorState)

List returns the list of actors

func (*ActorMap) ListOnline

func (am *ActorMap) ListOnline() []api.UUID

ListOnline returns a list of online actors

func (*ActorMap) SetOnline

func (am *ActorMap) SetOnline(id api.UUID, online bool)

SetOnline force the status of an actor

type ActorState

type ActorState struct {
	ID     api.UUID
	Name   string
	Kind   api.Actor_Kind
	Online bool
}

ActorState is emitted by the ActorMap when a actor status changes

Jump to

Keyboard shortcuts

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