gore-and-ash-sync-1.2.0.1: 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.API

Description

 

Synopsis

Documentation

class MonadIO m => SyncMonad m where Source #

Low level API for module Need at least one network channel to operate. If you open more than one channel, the module would use chanel id 1 as service channel, therefore count of channels on client and server should match (server won't response on channel 1 if it doesn't have it).

Methods

getSyncIdM :: HashableTypeRep -> m (Maybe Word64) Source #

Find actor id by it stable type representation

getSyncTypeRepM :: Word64 -> m (Maybe HashableTypeRep) Source #

Find actor type representation by it id

registerSyncIdM :: LoggingMonad m => HashableTypeRep -> m Word64 Source #

Generate and register new id for given actor type representation

addSyncTypeRepM :: LoggingMonad m => HashableTypeRep -> Word64 -> m () Source #

Register new type rep with given id, doesn't overide existing records

syncScheduleMessageM :: (NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> MessageType -> NetworkMessageType i -> m () Source #

Send message as soon as network id of actor is resolved

syncSetLoggingM :: Bool -> m () Source #

Switch on/off detailed logging of the module

syncSetRoleM :: SyncRole -> m () Source #

Setups behavior model in synchronizing of actor ids Note: clients should be slaves and server master

syncGetRoleM :: m SyncRole Source #

Returns current behavior model in synchronizing of actor ids Note: clients should be slaves and server master

syncRequestIdM :: forall proxy i. (ActorMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i) => Peer -> proxy i -> m () Source #

Send request for given peer for id of given actor

Instances

(MonadIO (mt m), SyncMonad m, ActorMonad m, NetworkMonad m, LoggingMonad m, MonadTrans mt) => SyncMonad (mt m) Source # 

Methods

getSyncIdM :: HashableTypeRep -> mt m (Maybe Word64) Source #

getSyncTypeRepM :: Word64 -> mt m (Maybe HashableTypeRep) Source #

registerSyncIdM :: HashableTypeRep -> mt m Word64 Source #

addSyncTypeRepM :: HashableTypeRep -> Word64 -> mt m () Source #

syncScheduleMessageM :: (NetworkMonad (mt m), LoggingMonad (mt m), NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> MessageType -> NetworkMessageType i -> mt m () Source #

syncSetLoggingM :: Bool -> mt m () Source #

syncSetRoleM :: SyncRole -> mt m () Source #

syncGetRoleM :: mt m SyncRole Source #

syncRequestIdM :: (ActorMonad (mt m), NetworkMonad (mt m), LoggingMonad (mt m), NetworkMessage i) => Peer -> proxy i -> mt m () Source #

MonadIO m => SyncMonad (SyncT s m) Source # 

Methods

getSyncIdM :: HashableTypeRep -> SyncT s m (Maybe Word64) Source #

getSyncTypeRepM :: Word64 -> SyncT s m (Maybe HashableTypeRep) Source #

registerSyncIdM :: HashableTypeRep -> SyncT s m Word64 Source #

addSyncTypeRepM :: HashableTypeRep -> Word64 -> SyncT s m () Source #

syncScheduleMessageM :: (NetworkMonad (SyncT s m), LoggingMonad (SyncT s m), NetworkMessage i, Serialize (NetworkMessageType i)) => Peer -> ChannelID -> i -> MessageType -> NetworkMessageType i -> SyncT s m () Source #

syncSetLoggingM :: Bool -> SyncT s m () Source #

syncSetRoleM :: SyncRole -> SyncT s m () Source #

syncGetRoleM :: SyncT s m SyncRole Source #

syncRequestIdM :: (ActorMonad (SyncT s m), NetworkMonad (SyncT s m), LoggingMonad (SyncT s m), NetworkMessage i) => Peer -> proxy i -> SyncT s m () Source #