fms

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: ISC Imports: 27 Imported by: 0

Documentation

Overview

Package fms encapsulates all the various parts of the Field Managent System, its associated configuration logic, and the APIs that talk to other systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventStreamer added in v0.1.9

type EventStreamer interface {
	Handler(nhttp.ResponseWriter, *nhttp.Request)

	PublishActionStart(string, string)
	PublishActionComplete(string)
	PublishError(error)
	PublishFileFetch(string)
	PublishLogLine(string)
}

EventStreamer represents the streaming interface server that allows websocket subscribers to join the event stream and get broadcast events.

type FMS added in v0.1.9

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

FMS encapsulates the FMS runnable.

func New added in v0.1.9

func New(opts ...Option) (*FMS, error)

New configures and returns an FMS instance that is a runnable containing the TLM, webserver, and associated other components.

func (*FMS) Serve added in v0.1.9

func (f *FMS) Serve(bind string) error

Serve commences serving of the FMS endpoints.

func (*FMS) Shutdown added in v0.1.9

func (f *FMS) Shutdown(ctx context.Context) error

Shutdown stops all components of the FMS.

type FileFetcher added in v0.1.9

type FileFetcher interface {
	FetchPackages() error
	FetchTools() error
}

FileFetcher fetches restricted files that cannot be baked into the image.

type NetController added in v0.1.9

type NetController interface {
	Zap() error
	Init() error
	SyncState(map[string]interface{}) error
	Converge(bool, string) error
	CycleRadio(string) error
	BootstrapPhase0() error
	BootstrapPhase1() error
	BootstrapPhase2() error
	BootstrapPhase3() error
}

NetController abstracts the functionality of the RouterOS controller so that the FMS can bootstrap and reconcile the network as required.

type Option added in v0.1.9

type Option func(*FMS) error

Option enables variadic option passing to the server on startup.

func WithEventStreamer added in v0.1.9

func WithEventStreamer(es EventStreamer) Option

WithEventStreamer allows injecting a streaming backend for the FMS to serve over http.

func WithFMSConf added in v0.1.9

func WithFMSConf(c *config.FMSConfig) Option

WithFMSConf generates all the quad data out of the config for the FMS itself. It provides a more convenient system than using the direct Quad interface.

func WithFileFetcher added in v0.1.9

func WithFileFetcher(fetcher FileFetcher) Option

WithFileFetcher injects the backend that may be used to fetch restrited artifacts from Mikrotik.

func WithLogger added in v0.1.9

func WithLogger(l hclog.Logger) Option

WithLogger sets the logger for the server.

func WithNetController added in v0.1.9

func WithNetController(nc NetController) Option

WithNetController injects the backend network controller that will actually modify network state.

func WithStartupWG added in v0.1.9

func WithStartupWG(wg *sync.WaitGroup) Option

WithStartupWG allows a waitgroup to be passed in so the server can notify when its finished with startup tasks to allow a nice message to be printed to the console.

func WithTeamLocationMapper added in v0.1.9

func WithTeamLocationMapper(t TeamLocationMapper) Option

WithTeamLocationMapper sets the mapper instance for the server to get from team number and schedule step to the field that they're supposed to be on.

type TeamLocationMapper added in v0.1.9

type TeamLocationMapper interface {
	GetFieldForTeam(int) (string, error)
	GetActualDS(string) (int, error)

	GetCurrentMapping() (map[int]string, error)
	InsertOnDemandMap(map[int]string) error

	GetStageMapping() (map[int]string, error)
	InsertStageMapping(map[int]string) error
	CommitStagedMap() error
}

TeamLocationMapper looks at all teams trying to fetch a value and tries to get them controller based on their current match and their number.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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