Portability | portable |
---|---|
Stability | experimental |
Maintainer | Nathan Hunter <nhunter@janrain.com> |
Safe Haskell | None |
Basic support for the Riak decentralized data store.
When storing and retrieving data, the functions in this module do not perform any encoding or decoding of data, nor do they resolve conflicts.
- type ClientID = ByteString
- data Client = Client {}
- defaultClient :: Client
- data Connection = Connection {
- connSock :: Socket
- connClient :: Client
- connBuffer :: IORef ByteString
- connect :: Client -> IO Connection
- disconnect :: Connection -> IO ()
- ping :: Connection -> IO ()
- getClientID :: Connection -> IO ClientID
- setClientID :: Connection -> ClientID -> IO ()
- getServerInfo :: Connection -> IO ServerInfo
- data Quorum
- get :: Connection -> Bucket -> Key -> R -> IO (Maybe (Seq Content, VClock))
- put :: Connection -> Bucket -> Key -> Maybe VClock -> Content -> W -> DW -> IO (Seq Content, VClock)
- put_ :: Connection -> Bucket -> Key -> Maybe VClock -> Content -> W -> DW -> IO ()
- delete :: Connection -> Bucket -> Key -> RW -> IO ()
- listBuckets :: Connection -> IO (Seq Bucket)
- foldKeys :: Connection -> Bucket -> (a -> Key -> IO a) -> a -> IO a
- getBucket :: Connection -> Bucket -> IO BucketProps
- setBucket :: Connection -> Bucket -> BucketProps -> IO ()
- mapReduce :: Connection -> Job -> (a -> MapReduce -> a) -> a -> IO a
Client configuration and identification
type ClientID = ByteStringSource
A client identifier. This is used by the Riak cluster when logging vector clock changes, and should be unique for each client.
Default client configuration. Talks to localhost, port 8087, with a randomly chosen client ID.
Connection management
data Connection Source
A connection to a Riak server.
Connection | |
|
connect :: Client -> IO ConnectionSource
Connect to a server.
disconnect :: Connection -> IO ()Source
Disconnect from a server.
ping :: Connection -> IO ()Source
Check to see if the connection to the server is alive.
getClientID :: Connection -> IO ClientIDSource
Find out from the server what client ID this connection is using.
setClientID :: Connection -> ClientID -> IO ()Source
Tell the server our client ID.
getServerInfo :: Connection -> IO ServerInfoSource
Retrieve information about the server.
Data management
A read/write quorum. The quantity of replicas that must respond
to a read or write request before it is considered successful. This
is defined as a bucket property or as one of the relevant
parameters to a single request (R
,W
,DW
,RW
).
get :: Connection -> Bucket -> Key -> R -> IO (Maybe (Seq Content, VClock))Source
Retrieve a value. This may return multiple conflicting siblings. Choosing among them is your responsibility.
put :: Connection -> Bucket -> Key -> Maybe VClock -> Content -> W -> DW -> IO (Seq Content, 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 bucket+key combination does not already exist. If
you omit a VClock
but the bucket+key does exist, your value
will not be stored.
put_ :: Connection -> Bucket -> Key -> Maybe VClock -> Content -> 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 bucket+key combination does not already exist. If
you omit a VClock
but the bucket+key does exist, your value
will not be stored, and you will not be notified.
Metadata
listBuckets :: Connection -> IO (Seq Bucket)Source
getBucket :: Connection -> Bucket -> IO BucketPropsSource
Retrieve the properties of a bucket.
setBucket :: Connection -> Bucket -> BucketProps -> IO ()Source
Store new properties for a bucket.