tools

package
v0.0.0-...-cdef871 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchActor = errors.New("no such pipeline")

ErrNoSuchActor is returned if the pipeline does not exist

View Source
var ErrNoSuchPipeline = errors.New("no such pipeline")

ErrNoSuchPipeline is returned if the pipeline does not exist

Functions

This section is empty.

Types

type ActorCache

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

ActorCache caches the pipeline definitions

func NewActorCache

func NewActorCache(control *control.Client) *ActorCache

NewActorCache creates a ActorCache instance

func (*ActorCache) Get

func (pc *ActorCache) Get(id api.UUID) (api.Actor, error)

Get returns a pipeline info

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 zerolog.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

type PipelineCache

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

PipelineCache caches the pipeline definitions

func NewPipelineCache

func NewPipelineCache(control *control.Client) *PipelineCache

NewPipelineCache creates a PipelineCache instance

func (*PipelineCache) Get

func (pc *PipelineCache) Get(id api.UUID) (api.PipelineInfo, error)

Get returns a pipeline info

Jump to

Keyboard shortcuts

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