gore-and-ash-sync-1.2.0.0: Gore&Ash module for high level network synchronization

Copyright(c) Anton Gushcha, 2015-2016
LicenseBSD3
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Game.GoreAndAsh.Sync.State

Description

 

Synopsis

Documentation

data SyncState s Source

Inner state of sync module

s
- State of next module, the states are chained via nesting.

Constructors

SyncState 

Fields

syncNextState :: !s

Next module in chain

syncIdMap :: !(HashMap HashableTypeRep Word64)

Mapping from type representation to id

syncIdMapRev :: !(HashMap Word64 HashableTypeRep)

Reverse mapping from id to type representation

syncNextId :: !Word64

Next empty id for registering, value zero is service value

syncScheduledMessages :: !(HashMap Peer (Seq (String, ChannelID, Word64 -> Message)))

Messages that are waiting resolving of network id of actor Actor name and actor local id is stored with the message to sent

syncLogging :: !Bool

Flag that enables detailed logging

syncRole :: !SyncRole

Current model of synchronization

Instances

Generic (SyncState s) Source 
NFData s => NFData (SyncState s) Source 
Monad m => MonadState (SyncState s) (SyncT s m) 
type Rep (SyncState s) Source 

data SyncRole Source

Defines behavior in synchronization for actor ids

Constructors

SyncMaster

Registers types of actors

SyncSlave

Always ask for ids from other nodes

class ActorMessage i => NetworkMessage i Source

Extension for actor message, messages that are sent to remote host

Associated Types

type NetworkMessageType i :: * Source

Corresponding message payload for i identifier, usually ADT

data SyncServiceMsg Source

Internal service message for synchronizing ids of actors

Constructors

SyncServiceRequestId !String

Request id of actor with specified name

SyncServiceResponseId !String !Word64

Response with actor id and name

SyncServiceResponseNotRegistered !String

Response that given actor is not found

emptySyncState :: s -> SyncState s Source

Make empty sync state