clojurewerkz.welle.kv
default-retrier
Default operation retrier that will be used by operations such as fetch and
store
delete
(delete client bucket-name key)
(delete client bucket-name key {:keys [r pr w dw pw rw vclock timeout retrier], :or {retrier default-retrier}})
delete-all
(delete-all client bucket-name keys)
(delete-all client bucket-name keys & rest)
Deletes multiple objects. This function relies on clojure.core/pmap to
delete multiple keys, so it may be inappropriate for cases where any
potential race conditions between individual delete operations is a problem.
For deleting a very large number of keys (say, thousands), consider using
map/reduce
delete-all-via-2i
(delete-all-via-2i client bucket-name field value)
(delete-all-via-2i client bucket-name field value & rest)
Concurrently deletes multiple objects with keys retrieved via a secondary
index (2i) query.
fetch
(fetch client bucket-name key)
(fetch client bucket-name key {:keys [r pr not-found-ok basic-quorum head-only return-deleted-vclock if-modified-since if-modified-vclock skip-deserialize timeout retrier resolver], :or {retrier default-retrier}})
Fetches an object and all its siblings (if there are any). As such, it
always returns a list. In cases you are sure will produce no siblings,
consider using `clojurewerkz.welle.kv/fetch-one`.
This function will filter out tombstones (objects that were deleted but not
yet resolved/garbage collected by the storage engine) unless
:return-deleted-vclock is passed as true.
Available options:
`:basic-quorum` (true or false): whether to return early in some failure
cases (eg. when `:r` is 1 and you get 2 errors and a success `:basic-quorum`
set to true would return an error)
`:notfound-ok` (true or false): whether to treat notfounds as successful
reads for the purposes of `:r`
`:vtag`: when accessing an object with siblings, which sibling to retrieve.
`:if-none-match` (date): a date for conditional get. Only supported by HTTP
transport.
`:if-modified-vclock`: a vclock instance to use for conditional get. Only
supported by Protocol Buffers transport.
`:return-deleted-vclock` (true or false): should tombstones (objects that
have been deleted but not yet resolved/GCed) be returned?
`:head-only` (true or false): should the response only return object
metadata, not its value?
`:skip-deserialize` (true or false): should the deserialization of the value
be skipped?
fetch-one
(fetch-one & args)
Fetches a single object. If siblings are found, passes them on to the
provided resolver or raises an exception. In situations when you are
interested in getting all siblings back, use `clojurewerkz.welle.kv/fetch`
instead.
has-value?
(has-value? m)
Returns true if a given Riak response is empty
index-query
(index-query client bucket-name field value)
Performs a secondary index (2i) query. Provided value can be either
non-collection or a collection (typically vector). In the former case, a
value query is performed. In the latter case, a range query is performed.
Learn more in Riak's documentation on secondary indexes at http://docs.basho.com/riak/latest/dev/using/2i/
modify
(modify client bucket-name key f {:keys [r pr not-found-ok basic-quorum head-only return-deleted-vclock if-modified-since if-modified-vclock skip-deserialize retrier resolver w dw pw indexes links vtag last-modified return-body if-none-match if-not-modified content-type metadata], :or {retrier default-retrier}})
Modifies an object with the given bucket and key by fetching it, applying a
function to it and storing it back. Assumes that the fetch operation returns
no siblings (a collection with just one Riak object), either via request or
after applying a resolver.
The mutating function is passed the entire Riak object as an immutable map,
not just value. Mutation sets :last-modified of the object to the current
timestamp.
Takes the same options as clojurewerkz.welle.kv/fetch and
clojurewerkz.welle.kv/store.
Returns the same results as clojurewerkz.welle.kv/store.
store
(store client bucket-name key value)
(store client bucket-name key value {:keys [w dw pw indexes links vclock vtag last-modified return-body if-none-match if-not-modified timeout content-type metadata retrier resolver], :or {content-type Constants/CTYPE_OCTET_STREAM, metadata {}, retrier default-retrier}})
Stores an object in Riak.
tombstone?
(tombstone? m)
Returns true if a given Riak object is a tombstone (was deleted but not yet
GCed)