Class DirectoryLayer

java.lang.Object
com.apple.foundationdb.directory.DirectoryLayer
All Implemented Interfaces:
Directory

public class DirectoryLayer extends Object implements Directory
Provides a class for managing directories in FoundationDB.

The FoundationDB API provides directories as a tool for managing related Subspaces. Directories are a recommended approach for administering applications. Each application should create or open at least one directory to manage its subspaces. For general guidance on directory usage, see the discussion in the Developer Guide.

Directories are identified by hierarchical paths analogous to the paths in a Unix-like file system. A path is represented as a List of strings. Each directory has an associated subspace used to store its content. The layer maps each path to a short prefix used for the corresponding subspace. In effect, directories provide a level of indirection for access to subspaces.

  • Field Details

  • Constructor Details

    • DirectoryLayer

      public DirectoryLayer()
      Constructor for a DirectoryLayer formed with default node and content subspaces. A DirectoryLayer defines a new root directory. The node subspace and content subspace control where the directory metadata and contents, respectively, are stored. The default root directory has a node subspace with raw prefix \xFE and a content subspace with no prefix. Prefixes can not be specified in calls to Directory.create(TransactionContext, List, byte[], byte[]).
      See Also:
    • DirectoryLayer

      public DirectoryLayer(boolean allowManualPrefixes)
      Constructor for a DirectoryLayer formed with default node and content subspaces. A DirectoryLayer defines a new root directory. The node subspace and content subspace control where the directory metadata and contents, respectively, are stored. The default root directory has a node subspace with raw prefix \xFE and a content subspace with no prefix.
      Parameters:
      allowManualPrefixes - whether or not prefixes can be specified in calls to Directory.create(TransactionContext, List, byte[], byte[])
    • DirectoryLayer

      public DirectoryLayer(Subspace nodeSubspace, Subspace contentSubspace)
      Constructor for a DirectoryLayer formed with a specified node subspace and specified content subspace. A DirectoryLayer defines a new root directory. The node subspace and content subspace control where the directory metadata and contents, respectively, are stored. The default root directory has a node subspace with raw prefix \xFE and a content subspace with no prefix. Specifying more restrictive values for the node subspace and content subspace will allow using the directory layer alongside other content in a database. Prefixes can not be specified in calls to Directory.create(TransactionContext, List, byte[], byte[]).
      Parameters:
      nodeSubspace - a Subspace used to store directory metadata
      contentSubspace - a Subspace used to store directory content
    • DirectoryLayer

      public DirectoryLayer(Subspace nodeSubspace, Subspace contentSubspace, boolean allowManualPrefixes)
      Constructor for a DirectoryLayer formed with a specified node subspace and specified content subspace. A DirectoryLayer defines a new root directory. The node subspace and content subspace control where the directory metadata and contents, respectively, are stored. The default root directory has a node subspace with raw prefix \xFE and a content subspace with no prefix. Specifying more restrictive values for the node subspace and content subspace will allow using the directory layer alongside other content in a database.
      Parameters:
      nodeSubspace - a Subspace used to store directory metadata
      contentSubspace - a Subspace used to store directory content
      allowManualPrefixes - whether or not prefixes can be specified in calls to Directory.create(TransactionContext, List, byte[], byte[])
  • Method Details