Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { Add(groupID simulations.GroupID, rs *RunningSimulation, t ignws.PubSubWebsocketTransporter) error ListExpiredSimulations() []*RunningSimulation ListFinishedSimulations() []*RunningSimulation ListExpiredAndFinishedSimulations() []*RunningSimulation GetTransporter(groupID simulations.GroupID) ignws.PubSubWebsocketTransporter Free(groupID simulations.GroupID) Remove(groupID simulations.GroupID) error Exists(groupID simulations.GroupID) bool Debug(gid simulations.GroupID) (interface{}, *ign.ErrMsg) Reconnect(groupID simulations.GroupID) error }
Manager describes a set of methods to handle a set of RunningSimulation and their connections to different websocket servers.
func NewManager ¶
func NewManager() Manager
NewManager initializes a running simulation's manager in charge of communicating to websocket servers.
type RunningSimulation ¶
type RunningSimulation struct { // GroupID has a reference to the simulations.GroupID value to identify a simulation. GroupID simulations.GroupID // CreatedAt keeps track of the entire simulation group launch time. CreatedAt time.Time // MaxValidUntil keeps track of the Max time this simulation should be automatically // terminated. It is used to avoid dangling simulations. MaxValidUntil time.Time // Finished indicates if the simulation has finished running. A "finished" message in the warmup topic will mark the // simulation as finished. Finished bool // Transport has a reference to a publisher/subscriber transporting mechanism using websockets. Transport ignws.PubSubWebsocketTransporter // contains filtered or unexported fields }
RunningSimulation is a representation of a simulations.Simulation that has been launched by workers.
func NewRunningSimulation ¶
func NewRunningSimulation(sim simulations.Simulation) *RunningSimulation
NewRunningSimulation initializes a new RunningSimulation identified by the given groupID that will run for a maximum amount of maxSimSeconds seconds and will be valid for the duration given in validFor.
func (*RunningSimulation) IsExpired ¶
func (rs *RunningSimulation) IsExpired() bool
IsExpired returns true if the RunningSimulation has expired.
func (*RunningSimulation) ReadWarmup ¶
ReadWarmup is the callback passed to the websocket client that will be invoked each time a message is received at the /subt/start topic.