net

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(t *TLM)

Option configures the TLM

func WithController

func WithController(c *config.Configurator) Option

WithController sets the network controller instance that will manage the network for this TLM.

func WithLogger

func WithLogger(l hclog.Logger) Option

WithLogger configures the logger for the team location mapper

func WithSaveState added in v0.1.7

func WithSaveState(p string) Option

WithSaveState provides a path to save the tlm data to across application reloads.

func WithStartupWG

func WithStartupWG(w *sync.WaitGroup) Option

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

type TLM

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

TLM is a Team Location Mapper that contains a static mapping.

func New

func New(opts ...Option) *TLM

New configures the TLM with the given options.

func (*TLM) GetCurrentMapping

func (tlm *TLM) GetCurrentMapping() (map[int]string, error)

GetCurrentMapping is a convenience function to retrieve the current mapping for the current match.

func (*TLM) GetCurrentTeams

func (tlm *TLM) GetCurrentTeams() []int

GetCurrentTeams returns the teams that are expected to be on the field at this time.

func (*TLM) GetFieldForTeam

func (tlm *TLM) GetFieldForTeam(team int) (string, error)

GetFieldForTeam returns the current location for a given team number.

func (*TLM) InsertOnDemandMap

func (tlm *TLM) InsertOnDemandMap(m map[int]string) error

InsertOnDemandMap inserts an on-demand mapping that overrides any current schedule. WARNING: This is immediate.

func (*TLM) RecoverState added in v0.1.7

func (tlm *TLM) RecoverState() error

RecoverState loads the TLM data from a file.

func (*TLM) SaveState added in v0.1.7

func (tlm *TLM) SaveState() error

SaveState saves the TLM data to a file that can be recovered later.

Jump to

Keyboard shortcuts

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