crdt-10.3: Conflict-free replicated data types

Safe HaskellSafe
LanguageHaskell2010

CRDT.Cv.PNCounter

Contents

Synopsis

Documentation

data PNCounter a Source #

Positive-negative counter. Allows incrementing and decrementing. Nice example of combining of existing CvRDT (GCounter in this case) to create another CvRDT.

Constructors

PNCounter 

Fields

Instances
Eq a => Eq (PNCounter a) Source # 
Instance details

Defined in CRDT.Cv.PNCounter

Methods

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

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

Show a => Show (PNCounter a) Source # 
Instance details

Defined in CRDT.Cv.PNCounter

Ord a => Semigroup (PNCounter a) Source # 
Instance details

Defined in CRDT.Cv.PNCounter

Methods

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

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

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

Ord a => Semilattice (PNCounter a) Source #

See CvRDT

Instance details

Defined in CRDT.Cv.PNCounter

initial :: PNCounter a Source #

Initial state

query :: Num a => PNCounter a -> a Source #

Get value from the state

Operations

decrement Source #

Arguments

:: Num a 
=> Word

replica id

-> PNCounter a 
-> PNCounter a 

Decrement counter

increment Source #

Arguments

:: Num a 
=> Word

replica id

-> PNCounter a 
-> PNCounter a 

Increment counter