Safe Haskell | None |
---|---|
Language | Haskell2010 |
The directory layer provides tools for creating a
hierarchy of Subspace
s, which can be operated on efficiently with a
directory-like API. This is one of the official layers supported by all
language bindings. See the
official FoundationDB documentation
for more information.
This implementation of the directory layer does not yet support directory partitions. They will be added in the future.
Synopsis
- data DirectoryLayer
- defaultDirLayer :: DirectoryLayer
- newDirectoryLayer :: Subspace -> Subspace -> Bool -> DirectoryLayer
- data Directory
- type Path = [Text]
- dirSubspace :: Directory -> Subspace
- dirPath :: Directory -> Path
- dirLayer :: Directory -> ByteString
- open :: DirectoryLayer -> Path -> Transaction (Maybe Directory)
- createOrOpen :: DirectoryLayer -> Path -> Transaction Directory
- move :: DirectoryLayer -> Path -> Path -> Transaction (Maybe MoveError)
- remove :: DirectoryLayer -> Path -> Transaction Bool
- exists :: DirectoryLayer -> Path -> Transaction Bool
- list :: DirectoryLayer -> Path -> Transaction (Seq Text)
- open' :: DirectoryLayer -> Path -> ByteString -> Maybe ByteString -> Transaction (Maybe Directory)
- createOrOpen' :: DirectoryLayer -> Path -> ByteString -> Maybe ByteString -> Transaction Directory
Documentation
data DirectoryLayer Source #
Represents a directory tree. A value of this type must be supplied to all functions in this module.
Instances
Eq DirectoryLayer Source # | |
Defined in FoundationDB.Layer.Directory.Internal (==) :: DirectoryLayer -> DirectoryLayer -> Bool # (/=) :: DirectoryLayer -> DirectoryLayer -> Bool # | |
Ord DirectoryLayer Source # | |
Defined in FoundationDB.Layer.Directory.Internal compare :: DirectoryLayer -> DirectoryLayer -> Ordering # (<) :: DirectoryLayer -> DirectoryLayer -> Bool # (<=) :: DirectoryLayer -> DirectoryLayer -> Bool # (>) :: DirectoryLayer -> DirectoryLayer -> Bool # (>=) :: DirectoryLayer -> DirectoryLayer -> Bool # max :: DirectoryLayer -> DirectoryLayer -> DirectoryLayer # min :: DirectoryLayer -> DirectoryLayer -> DirectoryLayer # | |
Show DirectoryLayer Source # | |
Defined in FoundationDB.Layer.Directory.Internal showsPrec :: Int -> DirectoryLayer -> ShowS # show :: DirectoryLayer -> String # showList :: [DirectoryLayer] -> ShowS # |
defaultDirLayer :: DirectoryLayer Source #
The default directory layer has node subspace prefix 0xfe
.
This corresponds to using the defaults for all arguments to the
DirectoryLayer
constructor in other languages' bindings.
:: Subspace | node subspace for directory metadata |
-> Subspace | content subspace |
-> Bool | allow manual prefixes |
-> DirectoryLayer |
Creates a new directory layer, containing a hierarchy of directories.
Represents a single directory.
dirSubspace :: Directory -> Subspace Source #
Gets the content subspace of a directory, which can be used to store tuple-based keys.
dirLayer :: Directory -> ByteString Source #
Gets the layer tag that was specified when the directory was created.
open :: DirectoryLayer -> Path -> Transaction (Maybe Directory) Source #
Tries to open a directory at the given path.
If the directory exists, returns it. Otherwise, returns Nothing
.
createOrOpen :: DirectoryLayer -> Path -> Transaction Directory Source #
Opens a directory at the given path. If the directory does not exist, it is created.
:: DirectoryLayer | |
-> Path | from path |
-> Path | to path |
-> Transaction (Maybe MoveError) |
Move a directory from one path to another. Returns Just err
if an error
occurred. If an error is returned, the directory structure is left
unchanged.
remove :: DirectoryLayer -> Path -> Transaction Bool Source #
Remove a directory path, its contents, and all subdirectories.
Returns True
if removal succeeds. Fails for nonexistent paths and the root
directory. In cases of failure, the directory structure is unchanged.
exists :: DirectoryLayer -> Path -> Transaction Bool Source #
Returns True
iff the given path exists.
list :: DirectoryLayer -> Path -> Transaction (Seq Text) Source #
List the names of the immediate subdirectories of a directory. Returns an empty list if the directory does not exist.
Advanced usage
:: DirectoryLayer | |
-> Path | |
-> ByteString | layer |
-> Maybe ByteString | optional custom prefix |
-> Transaction (Maybe Directory) |
Open a directory, with optional custom prefix and layer.
Returns Nothing
if the directory doesn't exist.
:: DirectoryLayer | |
-> Path | |
-> ByteString | layer |
-> Maybe ByteString | optional custom prefix |
-> Transaction Directory |
Opens a directory at the given path, with optional custom prefix and layer.