riak-1.2.0.0: A Haskell client for the Riak decentralized data store
Safe HaskellNone
LanguageHaskell2010

Network.Riak.CRDT

Description

CRDT operations

  • Haskell-side

  • Riak-side

    • get to get a current value
    • sendModify to ask Riak to apply modifications

TL;DR example

>>> let c = Counter 41
>>> let op = CounterInc 1
>>> modify op c
Counter 42
>>> get conn "counters" "bucket" "key"
Just (DTCounter (Counter 41))
>>> sendModify conn "counters" "bucket" "key" [op] >> get conn "counters" "bucket" "key"
Just (DTCounter (Counter 42))
Synopsis

Documentation

class MapCRDT a => CRDT a op | a -> op, op -> a where Source #

CRDT types

Methods

modify :: op -> a -> a Source #

Modify a value by applying an operation

sendModify :: Connection -> BucketType -> Bucket -> Key -> [op] -> IO () Source #

Request riak a modification

Instances

Instances details
CRDT Counter CounterOp Source # 
Instance details

Defined in Network.Riak.CRDT

CRDT Set SetOp Source # 
Instance details

Defined in Network.Riak.CRDT

Methods

modify :: SetOp -> Set -> Set Source #

sendModify :: Connection -> BucketType -> Bucket -> Key -> [SetOp] -> IO () Source #

CRDT Map MapOp Source # 
Instance details

Defined in Network.Riak.CRDT

Methods

modify :: MapOp -> Map -> Map Source #

sendModify :: Connection -> BucketType -> Bucket -> Key -> [MapOp] -> IO () Source #