tracker

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

README

tracker

State: Design needs to be finalized.

Components

  • Client
    • How to access users grouped by job?
    • Use Nats and/ or broker channels for accessing the event data.
    • Use key value store to access data by user ID. -> What about the user's job?
  • Worker
    • Load locations from database and generate an event object (like with the broker channel)
    • Store state in key value store for accessing data by user IDs. -> What about the user's job?

What is the state the tracker needs to keeps?

  • User's job
  • User's on-duty state
  • User's unit id -> Centrum UserUnitMapping (settings.proto)

Documentation

Index

Constants

View Source
const (
	StreamName = "TRACKER"

	BaseSubject events.Subject = "tracker"

	UsersUpdate events.Type = "users_update"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ITracker

type ITracker interface {
	GetUsersByJob(job string) (*xsync.MapOf[int32, *livemap.UserMarker], bool)
	GetUserById(id int32) (*livemap.UserMarker, bool)
	GetAllActiveUsers() ([]*livemap.UserMarker, error)
	IsUserOnDuty(userId int32) bool

	Subscribe() chan *livemap.UsersUpdateEvent
	Unsubscribe(c chan *livemap.UsersUpdateEvent)
}

func New

func New(p Params) (ITracker, error)

func NewForTests

func NewForTests(p TestParams) ITracker

type Manager

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

func NewManager

func NewManager(p ManagerParams) (*Manager, error)

type ManagerParams

type ManagerParams struct {
	fx.In

	LC fx.Lifecycle

	Logger    *zap.Logger
	JS        *events.JSWrapper
	TP        *tracesdk.TracerProvider
	DB        *sql.DB
	Enricher  *mstlystcdata.Enricher
	Postals   postals.Postals
	Config    *config.Config
	State     *centrumstate.State
	AppConfig appconfig.IConfig
}

type Params

type Params struct {
	fx.In

	LC fx.Lifecycle

	Logger *zap.Logger
	TP     *tracesdk.TracerProvider
	JS     *events.JSWrapper
}

type TestParams

type TestParams struct {
	fx.In

	LC fx.Lifecycle
}

type TestTracker

type TestTracker struct {
	ITracker
	// contains filtered or unexported fields
}

func (*TestTracker) GetAllActiveUsers

func (s *TestTracker) GetAllActiveUsers() ([]*livemap.UserMarker, error)

func (*TestTracker) GetUserById

func (s *TestTracker) GetUserById(id int32) (*livemap.UserMarker, bool)

func (*TestTracker) GetUserByJobAndID

func (s *TestTracker) GetUserByJobAndID(job string, userId int32) (*livemap.UserMarker, bool)

func (*TestTracker) GetUsersByJob

func (s *TestTracker) GetUsersByJob(job string) (*xsync.MapOf[int32, *livemap.UserMarker], bool)

func (*TestTracker) IsUserOnDuty

func (s *TestTracker) IsUserOnDuty(userId int32) bool

func (*TestTracker) Subscribe

func (s *TestTracker) Subscribe() chan *livemap.UsersUpdateEvent

func (*TestTracker) Unsubscribe

func (s *TestTracker) Unsubscribe(c chan *livemap.UsersUpdateEvent)

type Tracker

type Tracker struct {
	ITracker
	// contains filtered or unexported fields
}

func (*Tracker) GetAllActiveUsers

func (s *Tracker) GetAllActiveUsers() ([]*livemap.UserMarker, error)

func (*Tracker) GetUserById

func (s *Tracker) GetUserById(id int32) (*livemap.UserMarker, bool)

func (*Tracker) GetUsersByJob

func (s *Tracker) GetUsersByJob(job string) (*xsync.MapOf[int32, *livemap.UserMarker], bool)

func (*Tracker) IsUserOnDuty

func (s *Tracker) IsUserOnDuty(userId int32) bool

func (*Tracker) Subscribe

func (s *Tracker) Subscribe() chan *livemap.UsersUpdateEvent

func (*Tracker) Unsubscribe

func (s *Tracker) Unsubscribe(c chan *livemap.UsersUpdateEvent)

Jump to

Keyboard shortcuts

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