manager

package
v0.8.16 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const DispatchExpirationTime = 31 * time.Second
View Source
const (
	MaxCancelledDispatchesPerRun = 4
)

Variables

View Source
var HousekeeperModule = fx.Module("centrum_manager_housekeeper", fx.Provide(
	NewHousekeeper,
))
View Source
var Module = fx.Module("centrum_manager", fx.Provide(
	New,
))

Functions

This section is empty.

Types

type Housekeeper added in v0.8.11

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

func NewHousekeeper added in v0.8.11

func NewHousekeeper(p HousekeeperParams) *Housekeeper

func (*Housekeeper) ConvertPhoneJobMsgToDispatch added in v0.8.11

func (s *Housekeeper) ConvertPhoneJobMsgToDispatch() error

type HousekeeperParams added in v0.8.11

type HousekeeperParams struct {
	fx.In

	LC fx.Lifecycle

	Logger  *zap.Logger
	TP      *tracesdk.TracerProvider
	DB      *sql.DB
	Manager *Manager
	Config  *config.Config
}

type Manager

type Manager struct {
	*state.State
	// contains filtered or unexported fields
}

func New

func New(p Params) *Manager

func (*Manager) AddAttributeToDispatch added in v0.8.14

func (s *Manager) AddAttributeToDispatch(ctx context.Context, dsp *centrum.Dispatch, attribute string) error

func (*Manager) AddDispatchStatus

func (s *Manager) AddDispatchStatus(ctx context.Context, tx qrm.DB, job string, status *centrum.DispatchStatus, publish bool) error

func (*Manager) AddUnitStatus added in v0.8.11

func (s *Manager) AddUnitStatus(ctx context.Context, tx qrm.DB, job string, status *centrum.UnitStatus) error

func (*Manager) CheckIfBotNeeded

func (s *Manager) CheckIfBotNeeded(job string) bool

func (*Manager) CheckIfUserIsDisponent

func (s *Manager) CheckIfUserIsDisponent(job string, userId int32) bool

func (*Manager) CheckIfUserIsPartOfDispatch

func (s *Manager) CheckIfUserIsPartOfDispatch(userInfo *userinfo.UserInfo, dsp *centrum.Dispatch, disponentOkay bool) bool

func (*Manager) CheckIfUserPartOfUnit

func (s *Manager) CheckIfUserPartOfUnit(job string, userId int32, unit *centrum.Unit, disponentOkay bool) bool

func (*Manager) CreateDispatch

func (s *Manager) CreateDispatch(ctx context.Context, dsp *centrum.Dispatch) (*centrum.Dispatch, error)

func (*Manager) CreateUnit added in v0.8.11

func (s *Manager) CreateUnit(ctx context.Context, job string, unit *centrum.Unit) (*centrum.Unit, error)

func (*Manager) DeleteDispatch

func (s *Manager) DeleteDispatch(ctx context.Context, job string, id uint64, allTheWay bool) error

func (*Manager) DeleteUnit added in v0.8.11

func (s *Manager) DeleteUnit(ctx context.Context, job string, id uint64) error

func (*Manager) DispatchAssignmentExpirationTime

func (s *Manager) DispatchAssignmentExpirationTime() time.Time

func (*Manager) DisponentSignOn

func (s *Manager) DisponentSignOn(ctx context.Context, job string, userId int32, signon bool) error

func (*Manager) LoadDispatchAssignments added in v0.8.10

func (s *Manager) LoadDispatchAssignments(ctx context.Context, job string, dispatchId uint64) ([]*centrum.DispatchAssignment, error)

func (*Manager) LoadDispatchesFromDB added in v0.8.13

func (s *Manager) LoadDispatchesFromDB(ctx context.Context, id uint64) error

func (*Manager) LoadDisponentsFromDB added in v0.8.13

func (s *Manager) LoadDisponentsFromDB(ctx context.Context, job string) error

func (*Manager) LoadSettingsFromDB added in v0.8.13

func (s *Manager) LoadSettingsFromDB(ctx context.Context, job string) error

func (*Manager) LoadUnitIDForUserID

func (s *Manager) LoadUnitIDForUserID(ctx context.Context, userId int32) (uint64, error)

func (*Manager) LoadUnitsFromDB added in v0.8.13

func (s *Manager) LoadUnitsFromDB(ctx context.Context, id uint64) error

func (*Manager) ResolveUserById added in v0.8.10

func (s *Manager) ResolveUserById(ctx context.Context, u int32) (*users.User, error)

func (*Manager) TakeDispatch added in v0.8.11

func (s *Manager) TakeDispatch(ctx context.Context, job string, userId int32, unitId uint64, resp centrum.TakeDispatchResp, dispatchIds []uint64) error

func (*Manager) UpdateDispatch

func (s *Manager) UpdateDispatch(ctx context.Context, userJob string, userId *int32, dsp *centrum.Dispatch, publish bool) (*centrum.Dispatch, error)

func (*Manager) UpdateDispatchAssignments

func (s *Manager) UpdateDispatchAssignments(ctx context.Context, job string, userId *int32, dspId uint64, toAdd []uint64, toRemove []uint64, expiresAt time.Time) error

func (*Manager) UpdateDispatchStatus

func (s *Manager) UpdateDispatchStatus(ctx context.Context, job string, dspId uint64, in *centrum.DispatchStatus) (*centrum.DispatchStatus, error)

func (*Manager) UpdateSettingsInDB added in v0.8.11

func (s *Manager) UpdateSettingsInDB(ctx context.Context, job string, settings *centrum.Settings) (*centrum.Settings, error)

func (*Manager) UpdateUnit added in v0.8.11

func (s *Manager) UpdateUnit(ctx context.Context, job string, unit *centrum.Unit) (*centrum.Unit, error)

func (*Manager) UpdateUnitAssignments

func (s *Manager) UpdateUnitAssignments(ctx context.Context, job string, userId *int32, unitId uint64, toAdd []int32, toRemove []int32) error

func (*Manager) UpdateUnitStatus

func (s *Manager) UpdateUnitStatus(ctx context.Context, job string, unitId uint64, in *centrum.UnitStatus) (*centrum.UnitStatus, error)

type Params

type Params struct {
	fx.In

	LC fx.Lifecycle

	Logger   *zap.Logger
	TP       *tracesdk.TracerProvider
	DB       *sql.DB
	JS       nats.JetStreamContext
	Enricher *mstlystcdata.Enricher
	Postals  postals.Postals
	Tracker  tracker.ITracker
	Config   *config.Config

	State *state.State
}

Jump to

Keyboard shortcuts

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