workers

package
v0.0.0-...-219ab8e Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastMessage

type BroadcastMessage struct {
	Type    messages.MessageType
	Message interface{}
}

type BroadcastMessageWorker

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

func (*BroadcastMessageWorker) Start

func (w *BroadcastMessageWorker) Start(ctx context.Context)

type ConnectionEventWorker

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

func NewConnectionEventWorker

func NewConnectionEventWorker(opts NewConnectionEventWorkerOptions) *ConnectionEventWorker

NewConnectionEventWorker creates a new ConnectionEventWorker. The worker processes client events like connect and disconnect and writes server events to a queue for the game loop to process.

func (*ConnectionEventWorker) Start

func (w *ConnectionEventWorker) Start(ctx context.Context)

type NewBroadcastMessageWorkerOptions

type NewBroadcastMessageWorkerOptions struct {
	ClientManager        *network.ClientManager
	BroadcastMessageChan <-chan BroadcastMessage
}

type NewConnectionEventWorkerOptions

type NewConnectionEventWorkerOptions struct {
	ConnectionEventChan <-chan network.ConnectionEvent
	Repository          repositories.Repository
	ServerEventQueue    queue.Queue
}

type NewSaveGameStateWorkerOptions

type NewSaveGameStateWorkerOptions struct {
	Repository    repositories.Repository
	SaveStateChan <-chan SaveStateRequest
}

type SaveGameStateWorker

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

func NewSaveGameStateWorker

func NewSaveGameStateWorker(opts NewSaveGameStateWorkerOptions) *SaveGameStateWorker

NewSaveGameStateWorker creates a new SaveGameStateWorker. The worker processes save requests from the game loop and periodically saves the game state to the repository.

func (*SaveGameStateWorker) Start

func (w *SaveGameStateWorker) Start(ctx context.Context)

type SaveStateRequest

type SaveStateRequest struct {
	Timestamp int64
	Type      SaveStateRequestType
	State     interface{}
}

type SaveStateRequestType

type SaveStateRequestType int
const (
	SaveStateRequestTypePlayer SaveStateRequestType = iota
	SaveStateRequestTypeGame
)

Jump to

Keyboard shortcuts

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