ExRiak v0.3.0 ExRiak.PBSocket View Source
Wrapper around the :riakc_pb_socket
API.
Link to this section Summary
Functions
Deletes the key/value
Deletes the key/value, raising an error if there’s an issue
Fetches the representation of a convergent data type from Riak
Fetches the representation of a convergent data type from Riak
Gets bucket/key from server
Gets a bucket/key from server
Puts the metadata/value in the object under the bucket/key
Puts the metadata/value in the object under the bucket/key and raises on failure
Creates a linked process to communicate with the riak server
Link to this section Types
start_link_opt() :: {:hostname, String.t()} | {:port, port_number()}
Link to this section Functions
delete(pid(), bucket_locator(), key()) :: :ok | {:error, ExRiak.PBSocketError.t()}
Deletes the key/value.
delete!(pid(), bucket_locator(), key()) :: :ok | no_return()
Deletes the key/value, raising an error if there’s an issue.
fetch_type(pid(), bucket_locator(), key()) :: {:ok, ExRiak.DataType.t()} | {:error, :not_found | ExRiak.PBSocketError.t()}
Fetches the representation of a convergent data type from Riak.
fetch_type!(pid(), bucket_locator(), key()) :: ExRiak.DataType.t() | nil | no_return()
Fetches the representation of a convergent data type from Riak.
Returns nil if not found. Raises an ExRiak.PBSocketError
on failure.
get(pid(), bucket_locator(), key()) :: {:ok, ExRiak.Object.t()} | {:error, :not_found | ExRiak.PBSocketError.t()}
Gets bucket/key from server
get!(pid(), bucket_locator(), key()) :: ExRiak.Object.t() | nil | no_return()
Gets a bucket/key from server.
Returns nil if not found. Raises an ExRiak.PBSocketError
on failure.
Example
This function is especially useful for fetching or creating an object during an Object Update Cycle.
{:ok, conn} = PBSocket.start_link()
obj = PBSocket.get!(conn, "bucket", "key") || Object.new("bucket", "key")
put(pid(), ExRiak.Object.t()) :: :ok | {:ok, ExRiak.Object.t()} | {:error, ExRiak.PBSocketError.t() | ExRiak.SiblingsError.t()}
Puts the metadata/value in the object under the bucket/key.
put!(pid(), ExRiak.Object.t()) :: :ok | ExRiak.Object.t()
Puts the metadata/value in the object under the bucket/key and raises on failure.
start_link(start_link_opts()) :: GenServer.on_start()
Creates a linked process to communicate with the riak server.
Options:
:hostname
- IP/Hostname of the riak server. Defaults to"localhost"
. Can also set default value in application config with:config :ex_riak, default_hostname: "my-riak-host"
:port
- Port of the riak server. Defaults to8087
Can also set default value in application config with:config :ex_riak, default_port: 8087
Additional options are passed directly to
:riak_pb_socket.start_link/3