foundationdb-haskell-0.1.0.0: FoundationDB C client bindings
Safe HaskellNone
LanguageHaskell2010

FoundationDB.Layer.Directory

Description

The directory layer provides tools for creating a hierarchy of Subspaces, 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

Documentation

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.

newDirectoryLayer Source #

Arguments

:: Subspace

node subspace for directory metadata

-> Subspace

content subspace

-> Bool

allow manual prefixes

-> DirectoryLayer 

Creates a new directory layer, containing a hierarchy of directories.

type Path = [Text] Source #

A path is a list of unicode strings.

dirSubspace :: Directory -> Subspace Source #

Gets the content subspace of a directory, which can be used to store tuple-based keys.

dirPath :: Directory -> Path Source #

Gets the path of a directory.

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.

move Source #

Arguments

:: 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

open' Source #

Arguments

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

createOrOpen' Source #

Arguments

:: DirectoryLayer 
-> Path 
-> ByteString

layer

-> Maybe ByteString

optional custom prefix

-> Transaction Directory 

Opens a directory at the given path, with optional custom prefix and layer.