Portability | portable |
---|---|
Stability | experimental |
Maintainer | Bryan O'Sullivan <bos@mailrank.com> |
This module allows storage and retrieval of JSON-encoded data.
Functions automatically resolve conflicts using Resolvable
instances.
For instance, if a get
returns three siblings, a winner will be
chosen using mconcat
. If a put
results in a conflict, a winner
will be chosen using mconcat
, and the winner will be put
; this
will be repeated until no conflict occurs.
- get :: (FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> Key -> R -> IO (Maybe (c, VClock))
- getMany :: (FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> [Key] -> R -> IO [Maybe (c, VClock)]
- put :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO (c, VClock)
- put_ :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ()
- putMany :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO [(c, VClock)]
- putMany_ :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO ()
Documentation
get :: (FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> Key -> R -> IO (Maybe (c, VClock))Source
Retrieve a single value. If conflicting values are returned, the
Resolvable
is used to choose a winner.
getMany :: (FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> [Key] -> R -> IO [Maybe (c, VClock)]Source
Retrieve multiple values. If conflicting values are returned for
a key, the Resolvable
is used to choose a winner.
put :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO (c, VClock)Source
Store a single value, automatically resolving any vector clock conflicts that arise. A single invocation of this function may involve several roundtrips to the server to resolve conflicts.
If a conflict arises, a winner will be chosen using mconcat
, and
the winner will be stored; this will be repeated until no conflict
occurs.
The final value to be stored at the end of any conflict resolution is returned.
put_ :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ()Source
Store a single value, automatically resolving any vector clock conflicts that arise. A single invocation of this function may involve several roundtrips to the server to resolve conflicts.
If a conflict arises, a winner will be chosen using mconcat
, and
the winner will be stored; this will be repeated until no conflict
occurs.
putMany :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO [(c, VClock)]Source
Store multiple values, resolving any vector clock conflicts that arise. A single invocation of this function may involve several roundtrips to the server to resolve conflicts.
If any conflicts arise, a winner will be chosen in each case using
mconcat
, and the winners will be stored; this will be repeated
until no conflicts occur.
For each original value to be stored, the final value that was stored at the end of any conflict resolution is returned.
putMany_ :: (Eq c, FromJSON c, ToJSON c, Resolvable c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO ()Source
Store multiple values, resolving any vector clock conflicts that arise. A single invocation of this function may involve several roundtrips to the server to resolve conflicts.
If any conflicts arise, a winner will be chosen in each case using
mconcat
, and the winners will be stored; this will be repeated
until no conflicts occur.