crdt-2.1: Conflict-free replicated data types

Safe HaskellSafe
LanguageHaskell2010

CRDT.LWW

Contents

Synopsis

Documentation

data LWW a Source #

Last write wins. Assuming timestamp is unique. This type is both CmRDT and CvRDT.

Constructors

LWW 

Fields

Instances

Eq (LWW a) Source # 

Methods

(==) :: LWW a -> LWW a -> Bool #

(/=) :: LWW a -> LWW a -> Bool #

Ord (LWW a) Source # 

Methods

compare :: LWW a -> LWW a -> Ordering #

(<) :: LWW a -> LWW a -> Bool #

(<=) :: LWW a -> LWW a -> Bool #

(>) :: LWW a -> LWW a -> Bool #

(>=) :: LWW a -> LWW a -> Bool #

max :: LWW a -> LWW a -> LWW a #

min :: LWW a -> LWW a -> LWW a #

Show a => Show (LWW a) Source # 

Methods

showsPrec :: Int -> LWW a -> ShowS #

show :: LWW a -> String #

showList :: [LWW a] -> ShowS #

Semigroup (LWW a) Source #

Merge by choosing more recent timestamp.

Methods

(<>) :: LWW a -> LWW a -> LWW a #

sconcat :: NonEmpty (LWW a) -> LWW a #

stimes :: Integral b => b -> LWW a -> LWW a #

Semilattice (LWW a) Source #

See CvRDT

Eq a => CmRDT (LWW a) Source # 

Associated Types

type Op (LWW a) :: * Source #

type Payload (LWW a) :: * Source #

type View (LWW a) :: * Source #

Methods

updateAtSourcePre :: Op (LWW a) -> Payload (LWW a) -> Bool Source #

updateAtSource :: Clock m => Op (LWW a) -> m (LWW a) Source #

updateDownstream :: LWW a -> Payload (LWW a) -> Payload (LWW a) Source #

view :: Payload (LWW a) -> View (LWW a) Source #

CausalOrd (LWW a) Source # 

Methods

before :: LWW a -> LWW a -> Bool Source #

type Op (LWW a) Source # 
type Op (LWW a) = Assign a
type Payload (LWW a) Source # 
type Payload (LWW a) = LWW a
type View (LWW a) Source # 
type View (LWW a) = a

CvRDT

initial :: Clock f => a -> f (LWW a) Source #

Initialize state

assign :: Clock f => a -> LWW a -> f (LWW a) Source #

Change state as CvRDT operation. Current value is ignored, because new timestamp is always greater.

query :: LWW a -> a Source #

Query state

CmRDT

newtype Assign a Source #

Change state as CmRDT operation

Constructors

Assign a 

Instances

Eq a => Eq (Assign a) Source # 

Methods

(==) :: Assign a -> Assign a -> Bool #

(/=) :: Assign a -> Assign a -> Bool #

Show a => Show (Assign a) Source # 

Methods

showsPrec :: Int -> Assign a -> ShowS #

show :: Assign a -> String #

showList :: [Assign a] -> ShowS #