interval-tree-clock-0.2.0.0: Interval Tree Clocks
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Clock.IntervalTree

Description

An interval tree clock implementation as per Interval Tree Clocks: A Logical Clock for Dynamic Systems. Paper by Almeida, Paulo & Baquero, Carlos & Fonte, Victor. This implementation by Arne Winter.

Synopsis

Types

data Stamp Source #

Constructors

Stamp ITCId ITCEvent 

Instances

Instances details
Eq Stamp Source # 
Instance details

Defined in Data.Clock.IntervalTree

Methods

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

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

Show Stamp Source # 
Instance details

Defined in Data.Clock.IntervalTree

Methods

showsPrec :: Int -> Stamp -> ShowS #

show :: Stamp -> String #

showList :: [Stamp] -> ShowS #

Generic Stamp Source # 
Instance details

Defined in Data.Clock.IntervalTree

Associated Types

type Rep Stamp :: Type -> Type #

Methods

from :: Stamp -> Rep Stamp x #

to :: Rep Stamp x -> Stamp #

type Rep Stamp Source # 
Instance details

Defined in Data.Clock.IntervalTree

type Rep Stamp = D1 ('MetaData "Stamp" "Data.Clock.IntervalTree" "interval-tree-clock-0.2.0.0-inplace" 'False) (C1 ('MetaCons "Stamp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ITCId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ITCEvent)))

data ITCId Source #

Instances

Instances details
Eq ITCId Source # 
Instance details

Defined in Data.Clock.IntervalTree

Methods

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

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

Show ITCId Source # 
Instance details

Defined in Data.Clock.IntervalTree

Methods

showsPrec :: Int -> ITCId -> ShowS #

show :: ITCId -> String #

showList :: [ITCId] -> ShowS #

Generic ITCId Source # 
Instance details

Defined in Data.Clock.IntervalTree

Associated Types

type Rep ITCId :: Type -> Type #

Methods

from :: ITCId -> Rep ITCId x #

to :: Rep ITCId x -> ITCId #

type Rep ITCId Source # 
Instance details

Defined in Data.Clock.IntervalTree

type Rep ITCId = D1 ('MetaData "ITCId" "Data.Clock.IntervalTree" "interval-tree-clock-0.2.0.0-inplace" 'False) (C1 ('MetaCons "ITCIdBranch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ITCId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ITCId)) :+: (C1 ('MetaCons "ITCIdOff" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ITCIdOn" 'PrefixI 'False) (U1 :: Type -> Type)))

data ITCEvent Source #

Instances

Instances details
Eq ITCEvent Source # 
Instance details

Defined in Data.Clock.IntervalTree

Show ITCEvent Source # 
Instance details

Defined in Data.Clock.IntervalTree

Generic ITCEvent Source # 
Instance details

Defined in Data.Clock.IntervalTree

Associated Types

type Rep ITCEvent :: Type -> Type #

Methods

from :: ITCEvent -> Rep ITCEvent x #

to :: Rep ITCEvent x -> ITCEvent #

type Rep ITCEvent Source # 
Instance details

Defined in Data.Clock.IntervalTree

Seed

seed :: Stamp Source #

The seed stamp. The first peer is to use this, then fork others.

Operations

fork :: Stamp -> (Stamp, Stamp) Source #

use to register new peers. one stamp must be consecutively owned be the forking peer. the other stamp owned by host.

join :: Stamp -> Stamp -> Stamp Source #

inverse of fork. s = uncurry join (fork s) Note that the internal call to sumId may be partial, if the ITC Stamp was constructed through direct constructor usage. Using only fork and join as the safe API to create stamps will not lead to this inconsistency.

peek :: Stamp -> Stamp Source #

Anonymizes this stamp. Useful when sending messages or logging debug stamps.

event :: Stamp -> Stamp Source #

when something happened on this peer. use the new stamp afterwards.

Comparison

happenedBefore :: Stamp -> Stamp -> Bool Source #

the `happened before` relation for two stamps. (Note that I am unsure whether this is really the same relation as described by Lamport). Use this to examine causality of stamps.

data StampComparison Source #

Constructors

Before

A happened before B.

After

A happened after B.

Concurrent

A happened concurrent to B in logical time.

stampCompare :: Stamp -> Stamp -> StampComparison Source #

Compare two stamps. Note that stamp is not an instance of Ord because a <= b and b <= a does not imply a = b: rather that a happened concurrent to b per logical time.