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

Portabilityportable
Stabilityexperimental
MaintainerBryan O'Sullivan <bos@mailrank.com>

Network.Riak.Basic

Contents

Description

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.

Synopsis

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.

data Client Source

Constructors

Client 

Fields

host :: HostName

Name of the server to connect to.

port :: ServiceName

Port number to connect to (default is 8087).

clientID :: ClientID

Client identifier.

defaultClient :: ClientSource

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.

Constructors

Connection 

Fields

connSock :: Socket
 
connClient :: Client

The configuration we connected with.

connBuffer :: IORef ByteString

Received data that has not yet been consumed.

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

data Quorum Source

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).

Constructors

Default

Use the default quorum settings for the bucket.

One

Success after one server has responded.

Quorum

Success after a quorum of servers has responded.

All

Success after all servers have responded.

get :: Connection -> Bucket -> Key -> R -> IO (Maybe (Seq Content, VClock))Source

Retrieve up 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.

put_ :: Connection -> Bucket -> Key -> Maybe VClock -> Content -> W -> DW -> IO ()Source

Store a single value, without the possibility of conflict resolution.

delete :: Connection -> Bucket -> Key -> RW -> IO ()Source

Delete a value.

Metadata

foldKeys :: Connection -> Bucket -> (a -> Key -> IO a) -> a -> IO aSource

getBucket :: Connection -> Bucket -> IO BucketPropsSource

Retrieve the properties of a bucket.

setBucket :: Connection -> Bucket -> BucketProps -> IO ()Source

Store new properties for a bucket.

Map/reduce