statuspb

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TraitName trait.Name = "smartcore.bos.Status"

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map tracks the status of multiple named status Model. Any names used to update/delete problems will be announced as Status traits using the given announcer.

func NewMap

func NewMap(announcer node.Announcer) *Map

func (*Map) DeleteProblem

func (m *Map) DeleteProblem(name, problem string)

func (*Map) Forget

func (m *Map) Forget(name string)

func (*Map) UpdateProblem

func (m *Map) UpdateProblem(name string, problem *gen.StatusLog_Problem)

func (*Map) WatchEvents

func (m *Map) WatchEvents(ctx context.Context) <-chan WatchEvent

WatchEvents returns a chan that emits when a client starts pulling the status for a given name. The context of the event is the context of the client's request, so will be cancelled when the client disconnects.

type Model

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

Model provides an in-memory model for storing and retrieving problems as a status log. A Model can be used as a backing store for the StatusApi.

func NewModel

func NewModel(opts ...resource.Option) *Model

NewModel returns a new Model.

func (*Model) DeleteProblem

func (m *Model) DeleteProblem(name string)

DeleteProblem removes the named problem if it exists.

func (*Model) GetCurrentStatus

func (m *Model) GetCurrentStatus(readMask *fieldmaskpb.FieldMask) (*gen.StatusLog, error)

GetCurrentStatus returns all known problems as a status log.

func (*Model) PullCurrentStatus

func (m *Model) PullCurrentStatus(ctx context.Context, readMask *fieldmaskpb.FieldMask, updatesOnly bool) <-chan StatusLogChange

func (*Model) UpdateProblem

func (m *Model) UpdateProblem(problem *gen.StatusLog_Problem) (*gen.StatusLog_Problem, error)

UpdateProblem will add or update the given problem in the model. Pull methods will be notified.

type ModelServer

type ModelServer struct {
	gen.UnimplementedStatusApiServer
	// contains filtered or unexported fields
}

func NewModelServer

func NewModelServer(model *Model) *ModelServer

func (*ModelServer) GetCurrentStatus

func (s *ModelServer) GetCurrentStatus(_ context.Context, req *gen.GetCurrentStatusRequest) (*gen.StatusLog, error)

func (*ModelServer) PullCurrentStatus

func (s *ModelServer) PullCurrentStatus(request *gen.PullCurrentStatusRequest, server gen.StatusApi_PullCurrentStatusServer) error

type ProblemMerger

type ProblemMerger struct {
	BiggestProblem    *gen.StatusLog_Problem
	MostRecentNominal *gen.StatusLog_Problem
	// contains filtered or unexported fields
}

func (*ProblemMerger) AddProblem

func (pm *ProblemMerger) AddProblem(problem *gen.StatusLog_Problem)

func (*ProblemMerger) AddProblemMessages

func (pm *ProblemMerger) AddProblemMessages(problems []proto.Message)

func (*ProblemMerger) AddProblems

func (pm *ProblemMerger) AddProblems(problems []*gen.StatusLog_Problem)

func (*ProblemMerger) AddStatusLog

func (pm *ProblemMerger) AddStatusLog(sl *gen.StatusLog)

func (*ProblemMerger) Build

func (pm *ProblemMerger) Build() *gen.StatusLog

func (*ProblemMerger) Empty

func (pm *ProblemMerger) Empty() bool

type StatusLogChange

type StatusLogChange struct {
	StatusLog  *gen.StatusLog
	ChangeTime time.Time
}

type WatchEvent

type WatchEvent struct {
	Name string
	Ctx  context.Context
}

Jump to

Keyboard shortcuts

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