server

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseServer

type BaseServer[T agent.IAgent[T]] struct {
	// contains filtered or unexported fields
}

func CreateBaseServer added in v2.1.0

func CreateBaseServer[T agent.IAgent[T]](iterations, turns int, turnMaxDuration time.Duration, messageBandwidth int) *BaseServer[T]

generate a server instance based on a mapping function and number of iterations

func (*BaseServer[T]) AccessAgentByID

func (serv *BaseServer[T]) AccessAgentByID(id uuid.UUID) T

func (*BaseServer[T]) AddAgent

func (serv *BaseServer[T]) AddAgent(agent T)

func (*BaseServer[T]) AgentStoppedTalking

func (serv *BaseServer[T]) AgentStoppedTalking(id uuid.UUID)

func (*BaseServer[T]) DeliverMessage

func (server *BaseServer[T]) DeliverMessage(msg message.IMessage[T], recipient uuid.UUID)

func (*BaseServer[T]) GetAgentMap

func (serv *BaseServer[T]) GetAgentMap() map[uuid.UUID]T

func (*BaseServer[T]) GetAgentMessagingBandwidth

func (serv *BaseServer[T]) GetAgentMessagingBandwidth() int

func (*BaseServer[T]) GetDiagnosticEngine added in v2.1.0

func (serv *BaseServer[T]) GetDiagnosticEngine() diagnosticsEngine.IDiagnosticsEngine

func (*BaseServer[T]) GetIterations

func (serv *BaseServer[T]) GetIterations() int

func (*BaseServer[T]) GetTurns

func (serv *BaseServer[T]) GetTurns() int

func (*BaseServer[T]) RemoveAgent

func (serv *BaseServer[T]) RemoveAgent(agentToRemove T)

func (*BaseServer[T]) ReportMessagingDiagnostics added in v2.1.0

func (server *BaseServer[T]) ReportMessagingDiagnostics()

func (*BaseServer[T]) RunEndOfIteration

func (serv *BaseServer[T]) RunEndOfIteration(iteration int)

func (*BaseServer[T]) RunStartOfIteration

func (serv *BaseServer[T]) RunStartOfIteration(iteration int)

func (*BaseServer[T]) RunTurn

func (serv *BaseServer[T]) RunTurn(turn, iteration int)

func (*BaseServer[T]) SetGameRunner

func (serv *BaseServer[T]) SetGameRunner(handler GameRunner)

func (*BaseServer[T]) Start

func (serv *BaseServer[T]) Start()

func (*BaseServer[T]) ViewAgentIdSet

func (serv *BaseServer[T]) ViewAgentIdSet() map[uuid.UUID]struct{}

type GameRunner

type GameRunner interface {
	RunStartOfIteration(int)
	RunTurn(int, int)
	RunEndOfIteration(int)
}

type IAgentOperations

type IAgentOperations[T agent.IAgent[T]] interface {
	// gives access to the agents in the simulator
	GetAgentMap() map[uuid.UUID]T
	// adds an agent to the server
	AddAgent(T)
	// removes an agent from the server
	RemoveAgent(T)
}

type IGameStateController added in v2.1.0

type IGameStateController interface {
	// gives access to number of iteration in simulator
	GetIterations() int
	// gives access to number of turns in simulator
	GetTurns() int
	// injects a GameRunner interface into the server
	SetGameRunner(GameRunner)
	// begins simulator
	Start()
}

type IServer

type IServer[T agent.IAgent[T]] interface {
	// gives operations for adding/removing agents from the simulator
	IAgentOperations[T]
	// exposes server methods to agents for messaging, etc
	agent.IExposedServerFunctions[T]
	// exposes server methods for controlling game state
	IGameStateController
	// toggle logging of messaging diagnostics to console (default false)
	ReportMessagingDiagnostics()
}

Jump to

Keyboard shortcuts

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