Copyright | (c) 2011 MailRank Inc. |
---|---|
License | Apache |
Maintainer | Mark Hibberd <mark@hibberd.id.au>, Nathan Hunter <nhunter@janrain.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module allows storage and retrieval of data using the
IsContent
typeclass. This provides access to more of Riak's
storage features than JSON, e.g. links.
The functions in this module do not perform any conflict resolution.
Synopsis
- class IsContent c where
- parseContent :: RpbContent -> Parser c
- toContent :: c -> RpbContent
- fromContent :: IsContent c => RpbContent -> Maybe c
- get :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> R -> IO (Maybe ([c], VClock))
- getMany :: IsContent c => Connection -> Maybe BucketType -> Bucket -> [Key] -> R -> IO [Maybe ([c], VClock)]
- getByIndex :: Connection -> Bucket -> IndexQuery -> IO [Key]
- addIndexes :: [IndexValue] -> RpbContent -> RpbContent
- put :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock)
- putIndexed :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> [IndexValue] -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock)
- put_ :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ()
- putMany :: IsContent c => Connection -> Maybe BucketType -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO [([c], VClock)]
- putMany_ :: IsContent c => Connection -> Maybe BucketType -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO ()
Documentation
class IsContent c where Source #
parseContent :: RpbContent -> Parser c Source #
toContent :: c -> RpbContent Source #
Instances
IsContent () Source # | |
Defined in Network.Riak.Value parseContent :: RpbContent -> Parser () Source # toContent :: () -> RpbContent Source # | |
IsContent Value Source # | |
Defined in Network.Riak.Value parseContent :: RpbContent -> Parser Value Source # toContent :: Value -> RpbContent Source # | |
IsContent RpbContent Source # | |
Defined in Network.Riak.Value parseContent :: RpbContent -> Parser RpbContent Source # toContent :: RpbContent -> RpbContent Source # | |
IsContent a => IsContent (ResolvableMonoid a) Source # | |
Defined in Network.Riak.Value parseContent :: RpbContent -> Parser (ResolvableMonoid a) Source # toContent :: ResolvableMonoid a -> RpbContent Source # | |
(FromJSON a, ToJSON a) => IsContent (JSON a) Source # | |
Defined in Network.Riak.JSON parseContent :: RpbContent -> Parser (JSON a) Source # toContent :: JSON a -> RpbContent Source # |
fromContent :: IsContent c => RpbContent -> Maybe c Source #
get :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> R -> IO (Maybe ([c], VClock)) Source #
Retrieve a value. This may return multiple conflicting siblings. Choosing among them is your responsibility.
getMany :: IsContent c => Connection -> Maybe BucketType -> Bucket -> [Key] -> R -> IO [Maybe ([c], VClock)] Source #
getByIndex :: Connection -> Bucket -> IndexQuery -> IO [Key] Source #
Retrieve list of keys matching some index query.
addIndexes :: [IndexValue] -> RpbContent -> RpbContent Source #
Add indexes to a content value for a further put request.
put :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock) Source #
Store a single value. This may return multiple conflicting siblings. Choosing among them, and storing a new value, is your responsibility.
You should only supply Nothing
as a VClock
if you are sure
that the given type+bucket+key combination does not already exist.
If you omit a VClock
but the type+bucket+key does exist, your
value will not be stored.
putIndexed :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> [IndexValue] -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock) Source #
Store an indexed value.
put_ :: IsContent c => Connection -> Maybe BucketType -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO () Source #
Store a single value, without the possibility of conflict resolution.
You should only supply Nothing
as a VClock
if you are sure
that the given type+bucket+key combination does not already exist.
If you omit a VClock
but the type+bucket+key does exist, your
value will not be stored, and you will not be notified.
putMany :: IsContent c => Connection -> Maybe BucketType -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO [([c], VClock)] Source #
Store many values. This may return multiple conflicting siblings for each value stored. Choosing among them, and storing a new value in each case, is your responsibility.
You should only supply Nothing
as a VClock
if you are sure
that the given type+bucket+key combination does not already exist.
If you omit a VClock
but the type+bucket+key does exist, your
value will not be stored.
putMany_ :: IsContent c => Connection -> Maybe BucketType -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO () Source #
Store many values, without the possibility of conflict resolution.
You should only supply Nothing
as a VClock
if you are sure
that the given type+bucket+key combination does not already exist.
If you omit a VClock
but the type+bucket+key does exist, your
value will not be stored, and you will not be notified.