| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
FoundationDB.Layer.Subspace
Description
Subspaces allow you to easily attach a common prefix to tuple-encoded keys (See FoundationDB.Layer.Tuple) so that you can perform range reads and deletes over a set of related keys.
The subspace layer is one of the standard layers supported by all language bindings. See the official documentation for more information.
Synopsis
- newtype Subspace = Subspace {}
- subspace :: [Elem] -> Subspace
- prefixedSubspace :: ByteString -> [Elem] -> Subspace
- extend :: Subspace -> [Elem] -> Subspace
- pack :: Subspace -> [Elem] -> ByteString
- unpack :: Subspace -> ByteString -> Either String [Elem]
- contains :: Subspace -> ByteString -> Bool
- subspaceRangeQuery :: Subspace -> RangeQuery
- getLast :: Subspace -> Transaction (Maybe (ByteString, ByteString))
- subspaceKey :: Subspace -> ByteString
Creating subspaces
Represents a subspace of Tuple keys. A subspace is just a common prefix
for a set of tuples.
Constructors
| Subspace | |
Fields | |
Arguments
| :: [Elem] | Tuple with which to prefix the subspace. May not contain incomplete version stamps. |
| -> Subspace |
Create a subspace from a tuple.
Arguments
| :: ByteString | prefix |
| -> [Elem] | |
| -> Subspace |
Create a subspace from a raw bytestring prefix and a tuple.
Using subspaces
extend :: Subspace -> [Elem] -> Subspace Source #
Create a subsubspace by extending the prefix of a subspace by the given tuple.
unpack :: Subspace -> ByteString -> Either String [Elem] Source #
Decode a tuple that was encoded by pack.
Arguments
| :: Subspace | |
| -> ByteString | encoded key |
| -> Bool |
Returns True iff the subspace contains the given key.
subspaceRangeQuery :: Subspace -> RangeQuery Source #
Construct a range query that covers an entire subspace.
getLast :: Subspace -> Transaction (Maybe (ByteString, ByteString)) Source #
Get the last key,value pair in the subspace, if it exists.
subspaceKey :: Subspace -> ByteString Source #
Returns the bytestring prefix of the subspace. Equivalent to rawPrefix.
This function is provided for consistency with other language bindings.