Safe Haskell | None |
---|---|
Language | Haskell2010 |
Lamport clock network simulation.
ReplicaSim
provides Replica
and Clock
instances,
replicas may interchange data while they are connected in a NetworkSim
.
Synopsis
- data NetworkSimT m a
- data ReplicaSimT m a
- runNetworkSimT :: Monad m => NetworkSimT m a -> m a
- runReplicaSimT :: ReplicaId -> ReplicaSimT m a -> NetworkSimT m a
Documentation
data NetworkSimT m a Source #
Lamport clock simulation. Key is ReplicaId
.
Non-present value is equivalent to (0, initial).
Instances
data ReplicaSimT m a Source #
ReplicaSim inside Lamport clock simulation.
Instances
runNetworkSimT :: Monad m => NetworkSimT m a -> m a Source #
Execute network simulation
Usage:
runExceptT
. runNetworkSimT $ dorunReplicaSimT
r1 $ do actions...runReplicaSimT
r2 $ do actions...runReplicaSimT
r1 $ ...
Each runNetworkSimT
starts its own networks.
One shouldn't use in one network events generated in another.
runReplicaSimT :: ReplicaId -> ReplicaSimT m a -> NetworkSimT m a Source #