crdt-10.2: Conflict-free replicated data types

Safe HaskellNone
LanguageHaskell2010

CRDT.LamportClock

Contents

Synopsis

Documentation

newtype Pid Source #

Unique process identifier

Constructors

Pid Word64 

Instances

Eq Pid Source # 

Methods

(==) :: Pid -> Pid -> Bool #

(/=) :: Pid -> Pid -> Bool #

Ord Pid Source # 

Methods

compare :: Pid -> Pid -> Ordering #

(<) :: Pid -> Pid -> Bool #

(<=) :: Pid -> Pid -> Bool #

(>) :: Pid -> Pid -> Bool #

(>=) :: Pid -> Pid -> Bool #

max :: Pid -> Pid -> Pid #

min :: Pid -> Pid -> Pid #

Show Pid Source # 

Methods

showsPrec :: Int -> Pid -> ShowS #

show :: Pid -> String #

showList :: [Pid] -> ShowS #

Lamport timestamp (for a single process)

class Process m => Clock m where Source #

Minimal complete definition

getTimes, advance

Methods

getTimes Source #

Arguments

:: Natural

number of needed timestamps

-> m LamportTime

Starting value of the range. So return value t means range [t .. t + n - 1].

Get sequential timestamps.

Laws: 1. t1 <- getTimes n t2 <- getTime t2 >= t1 + n

  1. getTimes 0 == getTimes 1

advance :: LocalTime -> m () 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 #

Minimal complete definition

getPid

Methods

getPid :: m Pid Source #

Real Lamport clock

Helpers