riak-1.1.1.0: A Haskell client for the Riak decentralized data store

Safe HaskellNone
LanguageHaskell98

Network.Riak.CRDT.Types

Contents

Description

Haskell-side view of CRDT

Synopsis

Types

data DataType Source #

CRDT ADT.

get operations return value of this type

Counters

newtype Counter Source #

CRDT Counter hold a integer Count

>>> Counter 42

Constructors

Counter Count 

Instances

Eq Counter Source # 

Methods

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

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

Num Counter Source # 
Ord Counter Source # 
Show Counter Source # 
Generic Counter Source # 

Associated Types

type Rep Counter :: * -> * #

Methods

from :: Counter -> Rep Counter x #

to :: Rep Counter x -> Counter #

Semigroup Counter Source # 
Monoid Counter Source # 
Default Counter Source # 

Methods

def :: Counter #

NFData Counter Source # 

Methods

rnf :: Counter -> () #

CRDT Counter CounterOp Source # 
type Rep Counter Source # 
type Rep Counter = D1 (MetaData "Counter" "Network.Riak.CRDT.Types" "riak-1.1.1.0-L5x3ztinTpJGxePuZATC6K" True) (C1 (MetaCons "Counter" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Count)))

Modification

Sets

newtype Set Source #

CRDT Set is a Data.Set

>>> Set (Data.Set.fromList ["foo","bar"])

Constructors

Set (Set ByteString) 

Instances

Eq Set Source # 

Methods

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

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

Ord Set Source # 

Methods

compare :: Set -> Set -> Ordering #

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

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

(>) :: Set -> Set -> Bool #

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

max :: Set -> Set -> Set #

min :: Set -> Set -> Set #

Show Set Source # 

Methods

showsPrec :: Int -> Set -> ShowS #

show :: Set -> String #

showList :: [Set] -> ShowS #

Generic Set Source # 

Associated Types

type Rep Set :: * -> * #

Methods

from :: Set -> Rep Set x #

to :: Rep Set x -> Set #

Semigroup Set Source # 

Methods

(<>) :: Set -> Set -> Set #

sconcat :: NonEmpty Set -> Set #

stimes :: Integral b => b -> Set -> Set #

Monoid Set Source # 

Methods

mempty :: Set #

mappend :: Set -> Set -> Set #

mconcat :: [Set] -> Set #

Default Set Source # 

Methods

def :: Set #

NFData Set Source # 

Methods

rnf :: Set -> () #

CRDT Set SetOp Source # 

Methods

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

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

type Rep Set Source # 
type Rep Set = D1 (MetaData "Set" "Network.Riak.CRDT.Types" "riak-1.1.1.0-L5x3ztinTpJGxePuZATC6K" True) (C1 (MetaCons "Set" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set ByteString))))

Modification

data SetOp Source #

CRDT Set operations

Constructors

SetAdd ByteString

add element to the set

>>> SetAdd "foo"
SetRemove ByteString

remove element from the set

>>> SetRemove "bar"

Instances

Maps

newtype Map Source #

CRDT Map is a Data.Map indexed by MapField and holding MapEntry.

Maps are specials in a way that they can additionally hold Flags, Registers, and most importantly, other Maps.

Constructors

Map MapContent 

Instances

Eq Map Source # 

Methods

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

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

Show Map Source # 

Methods

showsPrec :: Int -> Map -> ShowS #

show :: Map -> String #

showList :: [Map] -> ShowS #

Generic Map Source # 

Associated Types

type Rep Map :: * -> * #

Methods

from :: Map -> Rep Map x #

to :: Rep Map x -> Map #

Default Map Source # 

Methods

def :: Map #

NFData Map Source # 

Methods

rnf :: Map -> () #

CRDT Map MapOp Source # 

Methods

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

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

type Rep Map Source # 
type Rep Map = D1 (MetaData "Map" "Network.Riak.CRDT.Types" "riak-1.1.1.0-L5x3ztinTpJGxePuZATC6K" True) (C1 (MetaCons "Map" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 MapContent)))

data MapField Source #

CRDT Map is indexed by MapField, which is a name tagged by a type (there may be different entries with the same name, but different types)

Inspection

xlookup :: MapPath -> MapEntryTag -> Map -> Maybe MapEntry Source #

Lookup a value of a given MapEntryTag type on a given MapPath inside a map

>>> lookup ("a" -/ "b") MapFlagTag $ { "a"/Map: { "b"/Flag: Flag False } } -- pseudo
Just (MapFlag (Flag False))

Modification

data MapOp Source #

map operations It's easier to use mapUpdate:

>>> "x" -/ "y" -/ "z" `mapUpdate` SetAdd "elem"
MapUpdate (MapPath ("x" :| ["y","z"])) (MapCounterOp (CounterInc 1))

Constructors

MapRemove MapField

remove value in map

MapUpdate MapPath MapValueOp

update value on path by operation

Instances

newtype MapPath Source #

Selector (“xpath”) inside Map

Constructors

MapPath (NonEmpty ByteString) 

mapUpdate :: IsMapOp o => MapPath -> o -> MapOp infixr 5 Source #

Registers

newtype Register Source #

Registers can only be held as a Map element.

Register holds a ByteString.

Constructors

Register ByteString 

Instances

Eq Register Source # 
Show Register Source # 
Generic Register Source # 

Associated Types

type Rep Register :: * -> * #

Methods

from :: Register -> Rep Register x #

to :: Rep Register x -> Register #

Semigroup Register Source # 
Monoid Register Source #

Last-wins monoid for Register

Default Register Source # 

Methods

def :: Register #

NFData Register Source # 

Methods

rnf :: Register -> () #

type Rep Register Source # 
type Rep Register = D1 (MetaData "Register" "Network.Riak.CRDT.Types" "riak-1.1.1.0-L5x3ztinTpJGxePuZATC6K" True) (C1 (MetaCons "Register" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString)))

Modification

data RegisterOp Source #

Registers can be set to a value

>>> RegisterSet "foo"

Constructors

RegisterSet !ByteString 

Flags

newtype Flag Source #

Flags can only be held as a Map element.

Flag can be set or unset

>>> Flag False

Constructors

Flag Bool 

Instances

Eq Flag Source # 

Methods

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

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

Ord Flag Source # 

Methods

compare :: Flag -> Flag -> Ordering #

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

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

(>) :: Flag -> Flag -> Bool #

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

max :: Flag -> Flag -> Flag #

min :: Flag -> Flag -> Flag #

Show Flag Source # 

Methods

showsPrec :: Int -> Flag -> ShowS #

show :: Flag -> String #

showList :: [Flag] -> ShowS #

Generic Flag Source # 

Associated Types

type Rep Flag :: * -> * #

Methods

from :: Flag -> Rep Flag x #

to :: Rep Flag x -> Flag #

Semigroup Flag Source #

Last-wins semigroup for Flag

Methods

(<>) :: Flag -> Flag -> Flag #

sconcat :: NonEmpty Flag -> Flag #

stimes :: Integral b => b -> Flag -> Flag #

Monoid Flag Source #

Last-wins monoid for Flag

Methods

mempty :: Flag #

mappend :: Flag -> Flag -> Flag #

mconcat :: [Flag] -> Flag #

Default Flag Source # 

Methods

def :: Flag #

NFData Flag Source # 

Methods

rnf :: Flag -> () #

type Rep Flag Source # 
type Rep Flag = D1 (MetaData "Flag" "Network.Riak.CRDT.Types" "riak-1.1.1.0-L5x3ztinTpJGxePuZATC6K" True) (C1 (MetaCons "Flag" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)))

Modification

data FlagOp Source #

Flags can be enabled / disabled

>>> FlagSet True

Constructors

FlagSet !Bool 

Instances

Misc

data NonEmpty a :: * -> * #

Non-empty (and non-strict) list type.

Since: 4.9.0.0

Constructors

a :| [a] infixr 5 

Instances

Monad NonEmpty 

Methods

(>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b #

(>>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #

return :: a -> NonEmpty a #

fail :: String -> NonEmpty a #

Functor NonEmpty 

Methods

fmap :: (a -> b) -> NonEmpty a -> NonEmpty b #

(<$) :: a -> NonEmpty b -> NonEmpty a #

MonadFix NonEmpty 

Methods

mfix :: (a -> NonEmpty a) -> NonEmpty a #

Applicative NonEmpty 

Methods

pure :: a -> NonEmpty a #

(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b #

(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #

(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a #

Foldable NonEmpty 

Methods

fold :: Monoid m => NonEmpty m -> m #

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m #

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b #

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b #

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b #

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b #

foldr1 :: (a -> a -> a) -> NonEmpty a -> a #

foldl1 :: (a -> a -> a) -> NonEmpty a -> a #

toList :: NonEmpty a -> [a] #

null :: NonEmpty a -> Bool #

length :: NonEmpty a -> Int #

elem :: Eq a => a -> NonEmpty a -> Bool #

maximum :: Ord a => NonEmpty a -> a #

minimum :: Ord a => NonEmpty a -> a #

sum :: Num a => NonEmpty a -> a #

product :: Num a => NonEmpty a -> a #

Traversable NonEmpty 

Methods

traverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) #

sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) #

mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) #

sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) #

Generic1 NonEmpty 

Associated Types

type Rep1 (NonEmpty :: * -> *) :: * -> * #

Methods

from1 :: NonEmpty a -> Rep1 NonEmpty a #

to1 :: Rep1 NonEmpty a -> NonEmpty a #

FromJSON1 NonEmpty 

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (NonEmpty a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [NonEmpty a] #

ToJSON1 NonEmpty 

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> NonEmpty a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [NonEmpty a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> NonEmpty a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [NonEmpty a] -> Encoding #

MonadZip NonEmpty 

Methods

mzip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b) #

mzipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c #

munzip :: NonEmpty (a, b) -> (NonEmpty a, NonEmpty b) #

IsList (NonEmpty a) 

Associated Types

type Item (NonEmpty a) :: * #

Methods

fromList :: [Item (NonEmpty a)] -> NonEmpty a #

fromListN :: Int -> [Item (NonEmpty a)] -> NonEmpty a #

toList :: NonEmpty a -> [Item (NonEmpty a)] #

Eq a => Eq (NonEmpty a) 

Methods

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

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

Data a => Data (NonEmpty a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NonEmpty a -> c (NonEmpty a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (NonEmpty a) #

toConstr :: NonEmpty a -> Constr #

dataTypeOf :: NonEmpty a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (NonEmpty a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (NonEmpty a)) #

gmapT :: (forall b. Data b => b -> b) -> NonEmpty a -> NonEmpty a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NonEmpty a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NonEmpty a -> r #

gmapQ :: (forall d. Data d => d -> u) -> NonEmpty a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> NonEmpty a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NonEmpty a -> m (NonEmpty a) #

Ord a => Ord (NonEmpty a) 

Methods

compare :: NonEmpty a -> NonEmpty a -> Ordering #

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

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

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

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

max :: NonEmpty a -> NonEmpty a -> NonEmpty a #

min :: NonEmpty a -> NonEmpty a -> NonEmpty a #

Read a => Read (NonEmpty a) 
Show a => Show (NonEmpty a) 

Methods

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

show :: NonEmpty a -> String #

showList :: [NonEmpty a] -> ShowS #

Generic (NonEmpty a) 

Associated Types

type Rep (NonEmpty a) :: * -> * #

Methods

from :: NonEmpty a -> Rep (NonEmpty a) x #

to :: Rep (NonEmpty a) x -> NonEmpty a #

Semigroup (NonEmpty a) 

Methods

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

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

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

Hashable a => Hashable (NonEmpty a) 

Methods

hashWithSalt :: Int -> NonEmpty a -> Int #

hash :: NonEmpty a -> Int #

FromJSON a => FromJSON (NonEmpty a) 
ToJSON a => ToJSON (NonEmpty a) 
NFData a => NFData (NonEmpty a)

Since: 1.4.2.0

Methods

rnf :: NonEmpty a -> () #

type Rep1 NonEmpty 
type Rep (NonEmpty a) 
type Item (NonEmpty a) 
type Item (NonEmpty a) = a