Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Pid = Pid Word64
- class Process m => Clock m where
- getTimes :: Natural -> m LamportTime
- advance :: LocalTime -> m ()
- data LamportTime = LamportTime LocalTime Pid
- getTime :: Clock m => m LamportTime
- type LocalTime = Natural
- class Monad m => Process m where
- data LamportClock a
- runLamportClock :: IORef LocalTime -> LamportClock a -> IO a
- getRealLocalTime :: IO LocalTime
- getMacAddress :: IO Word64
Documentation
Lamport timestamp (for a single process)
class Process m => Clock m where Source #
:: Natural | number of needed timestamps |
-> m LamportTime | Starting value of the range.
So return value |
Get sequential timestamps.
Laws: 1. t1 <- getTimes n t2 <- getTime t2 >= t1 + n
- getTimes 0 == getTimes 1
Instances
Clock LamportClock Source # | |
Defined in CRDT.LamportClock getTimes :: Natural -> LamportClock LamportTime Source # advance :: LocalTime -> LamportClock () Source # | |
Monad m => Clock (ProcessSimT m) Source # | |
Defined in CRDT.LamportClock.Simulation getTimes :: Natural -> ProcessSimT m LamportTime Source # advance :: LocalTime -> ProcessSimT m () Source # | |
Clock m => Clock (StateT s m) Source # | |
Clock m => Clock (ReaderT r m) Source # | |
data LamportTime Source #
Instances
Eq LamportTime Source # | |
Defined in CRDT.LamportClock (==) :: LamportTime -> LamportTime -> Bool # (/=) :: LamportTime -> LamportTime -> Bool # | |
Ord LamportTime Source # | |
Defined in CRDT.LamportClock compare :: LamportTime -> LamportTime -> Ordering # (<) :: LamportTime -> LamportTime -> Bool # (<=) :: LamportTime -> LamportTime -> Bool # (>) :: LamportTime -> LamportTime -> Bool # (>=) :: LamportTime -> LamportTime -> Bool # max :: LamportTime -> LamportTime -> LamportTime # min :: LamportTime -> LamportTime -> LamportTime # | |
Show LamportTime Source # | |
Defined in CRDT.LamportClock showsPrec :: Int -> LamportTime -> ShowS # show :: LamportTime -> String # showList :: [LamportTime] -> ShowS # |
getTime :: Clock m => m LamportTime Source #
type LocalTime = Natural Source #
Unix time in 10^{-7} seconds (100 ns), as in RFC 4122 and Swarm RON.
class Monad m => Process m where Source #
Instances
Process LamportClock Source # | |
Defined in CRDT.LamportClock getPid :: LamportClock Pid Source # | |
Monad m => Process (ProcessSimT m) Source # | |
Defined in CRDT.LamportClock.Simulation getPid :: ProcessSimT m Pid Source # | |
Process m => Process (StateT s m) Source # | |
Process m => Process (ReaderT r m) Source # | |
Real Lamport clock
data LamportClock a Source #
Instances
runLamportClock :: IORef LocalTime -> LamportClock a -> IO a Source #
Helpers
getMacAddress :: IO Word64 Source #