public class DirectorySubspace extends Subspace implements Directory
An instance of DirectorySubspace can be used for all the usual subspace operations. It can also be used to operate on the directory with which it was opened.
| Modifier and Type | Method and Description |
|---|---|
Future<DirectorySubspace> |
create(TransactionContext tcx,
List<String> subpath)
Creates a subdirectory of this
Directory located at subpath
(creating parent directories if necessary). |
Future<DirectorySubspace> |
create(TransactionContext tcx,
List<String> subpath,
byte[] otherLayer)
Creates a subdirectory of this
Directory located at subpath
(creating parent directories if necessary). |
Future<DirectorySubspace> |
create(TransactionContext tcx,
List<String> subpath,
byte[] otherLayer,
byte[] prefix)
Creates a subdirectory of this
Directory located at subpath
(creating parent directories if necessary). |
Future<DirectorySubspace> |
createOrOpen(TransactionContext tcx,
List<String> subpath)
Creates or opens the subdirectory of this
Directory located at subpath
(creating parent directories, if necessary). |
Future<DirectorySubspace> |
createOrOpen(TransactionContext tcx,
List<String> subpath,
byte[] otherLayer)
Creates or opens the subdirectory of this
Directory located at subpath
(creating parent directories, if necessary). |
boolean |
equals(Object rhs)
Returns whether this
DirectorySubspace is equal to rhs. |
Future<Boolean> |
exists(ReadTransactionContext tcx)
Checks if this
Directory exists. |
Future<Boolean> |
exists(ReadTransactionContext tcx,
List<String> subpath)
Checks if the subdirectory of this
Directory located at subpath exists. |
DirectoryLayer |
getDirectoryLayer()
Get the
DirectoryLayer that was used to create this Directory. |
byte[] |
getLayer()
Gets the layer byte string that was stored when this
Directory
was created. |
List<String> |
getPath()
Gets the path represented by this
Directory. |
Future<List<String>> |
list(ReadTransactionContext tcx)
List the subdirectories of this directory.
|
Future<List<String>> |
list(ReadTransactionContext tcx,
List<String> subpath)
List the subdirectories of this directory at a given
subpath. |
Future<DirectorySubspace> |
move(TransactionContext tcx,
List<String> oldSubpath,
List<String> newSubpath)
Moves the subdirectory of this
Directory located at oldSubpath to newSubpath. |
Future<DirectorySubspace> |
moveTo(TransactionContext tcx,
List<String> newAbsolutePath)
Moves this
Directory to the specified newAbsolutePath. |
Future<DirectorySubspace> |
open(ReadTransactionContext tcx,
List<String> subpath)
Opens the subdirectory of this
Directory located at subpath. |
Future<DirectorySubspace> |
open(ReadTransactionContext tcx,
List<String> subpath,
byte[] otherLayer)
Opens the subdirectory of this
Directory located at subpath. |
Future<Void> |
remove(TransactionContext tcx)
Removes this
Directory and all of its subdirectories, as well as all of their contents. |
Future<Void> |
remove(TransactionContext tcx,
List<String> subpath)
Removes the subdirectory of this
Directory located at subpath and all of its subdirectories,
as well as all of their contents. |
Future<Boolean> |
removeIfExists(TransactionContext tcx)
Removes this
Directory and all of its subdirectories, as well as all of their contents. |
Future<Boolean> |
removeIfExists(TransactionContext tcx,
List<String> subpath)
Removes the subdirectory of this
Directory located at subpath and all of its subdirectories,
as well as all of their contents. |
String |
toString() |
public String toString()
public boolean equals(Object rhs)
DirectorySubspace is equal to rhs.
Two DirectorySubspaces are equal if they were created by the same
DirectoryLayer and have the same path, layer, and subspace prefix.public List<String> getPath()
DirectoryDirectory.public byte[] getLayer()
DirectoryDirectory
was created.public DirectoryLayer getDirectoryLayer()
DirectoryDirectoryLayer that was used to create this Directory.getDirectoryLayer in interface DirectoryDirectoryLayer that created this Directorypublic Future<DirectorySubspace> createOrOpen(TransactionContext tcx, List<String> subpath)
DirectoryDirectory located at subpath
(creating parent directories, if necessary).createOrOpen in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set to the created or opened DirectorySubspacepublic Future<DirectorySubspace> createOrOpen(TransactionContext tcx, List<String> subpath, byte[] otherLayer)
DirectoryDirectory located at subpath
(creating parent directories, if necessary). If the directory is new, then the layer
byte string will be recorded as its layer. If the directory already exists, the layer
byte string will be compared against the layer set when the directory was created.
The returned Future can be set to the following errors:
MismatchedLayerException - if the directory has already been created with a different layer byte stringcreateOrOpen in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryotherLayer - a byte[] specifying a layer to set on a new directory or check for on an existing directoryFuture which will be set to the created or opened DirectorySubspacepublic Future<DirectorySubspace> open(ReadTransactionContext tcx, List<String> subpath)
DirectoryDirectory located at subpath.
The returned Future can be set to the following errors:
NoSuchDirectoryException - if the directory does not existopen in interface Directorytcx - the ReadTransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set to the opened DirectorySubspacepublic Future<DirectorySubspace> open(ReadTransactionContext tcx, List<String> subpath, byte[] otherLayer)
DirectoryDirectory located at subpath.
The layer byte string will be compared against the layer set when
the directory was created.
The returned Future can be set to the following errors:
MismatchedLayerException - if the directory was created with a different layer byte stringNoSuchDirectoryException - if the directory does not existopen in interface Directorytcx - the ReadTransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryotherLayer - a byte[] specifying the expected layerFuture which will be set to the opened DirectorySubspacepublic Future<DirectorySubspace> create(TransactionContext tcx, List<String> subpath)
DirectoryDirectory located at subpath
(creating parent directories if necessary).
The returned Future can be set to the following errors:
DirectoryAlreadyExistsException - if the given directory already existscreate in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set to the created DirectorySubspacepublic Future<DirectorySubspace> create(TransactionContext tcx, List<String> subpath, byte[] otherLayer)
DirectoryDirectory located at subpath
(creating parent directories if necessary). The layer byte string will be recorded as
the new directory's layer and checked by future calls to Directory.open(ReadTransactionContext, List, byte[]).
The returned Future can be set to the following errors:
DirectoryAlreadyExistsException - if the given directory already existscreate in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryotherLayer - a byte[] specifying a layer to set for the directoryFuture which will be set to the created DirectorySubspacepublic Future<DirectorySubspace> create(TransactionContext tcx, List<String> subpath, byte[] otherLayer, byte[] prefix)
DirectoryDirectory located at subpath
(creating parent directories if necessary). The layer byte string will be recorded as
the new directory's layer and checked by future calls to Directory.open(ReadTransactionContext, List, byte[]).
The specified prefix will be used for this directory's contents instead of allocating a
prefix automatically.
The returned Future can be set to the following errors:
DirectoryAlreadyExistsException - if the given directory already existscreate in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryotherLayer - a byte[] specifying a layer to set for the directoryprefix - a byte[] specifying the key prefix to use for the directory's contentsFuture which will be set to the created DirectorySubspacepublic Future<List<String>> list(ReadTransactionContext tcx)
DirectoryThe returned Future can be set to the following errors:
NoSuchDirectoryException - if this Directory doesn't existslist in interface Directorytcx - the ReadTransactionContext to execute this operation inFuture which will be set to a List<String> of names of the subdirectories
of this Directory. Each name is a unicode string representing the last component of a
subdirectory's path.public Future<List<String>> list(ReadTransactionContext tcx, List<String> subpath)
Directorysubpath.
The returned Future can be set to the following errors:
NoSuchDirectoryException - if no directory exists at subpathlist in interface Directorytcx - the ReadTransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set to a List<String> of names of the subdirectories
of the directory at subpath. Each name is a unicode string representing the last component
of a subdirectory's path.public Future<DirectorySubspace> move(TransactionContext tcx, List<String> oldSubpath, List<String> newSubpath)
DirectoryDirectory located at oldSubpath to newSubpath.
There is no effect on the physical prefix of the given directory, or on clients that already have the directory open.
It is invalid to move a directory to:
The returned Future can be set to the following errors:
NoSuchDirectoryException - if no Directory exists at oldSubpathDirectoryAlreadyExistsException - if a directory already exists at newSubpathDirectoryMoveException - if an invalid move location is specifiedmove in interface Directorytcx - the TransactionContext to execute this operation inoldSubpath - a List<String> specifying the subpath of the directory to movenewSubpath - a List<String> specifying the subpath to move toFuture which will be set to the DirectorySubspace for this Directory
at its new location.public Future<DirectorySubspace> moveTo(TransactionContext tcx, List<String> newAbsolutePath)
DirectoryDirectory to the specified newAbsolutePath.
There is no effect on the physical prefix of the given directory, or on clients that already have the directory open.
It is invalid to move a directory to:
The returned Future can be set to the following errors:
NoSuchDirectoryException - if this Directory doesn't existDirectoryAlreadyExistsException - if a directory already exists at newAbsolutePathDirectoryMoveException - if an invalid move location is specifiedmoveTo in interface Directorytcx - the TransactionContext to execute this operation innewAbsolutePath - a List<String> specifying the new absolute path for this DirectoryFuture which will be set to the DirectorySubspace for this Directory
at its new location.public Future<Void> remove(TransactionContext tcx)
DirectoryDirectory and all of its subdirectories, as well as all of their contents.
Warning: Clients that have already opened the directory might still insert data into its contents after it is removed.
The returned Future can be set to the following errors:
NoSuchDirectoryException - if this Directory doesn't existremove in interface Directorytcx - the TransactionContext to execute this operation inFuture which will be set once this Directory has been removedpublic Future<Void> remove(TransactionContext tcx, List<String> subpath)
DirectoryDirectory located at subpath and all of its subdirectories,
as well as all of their contents.
Warning: Clients that have already opened the directory might still insert data into its contents after it is removed.
The returned Future can be set to the following errors:
NoSuchDirectoryException - if no directory exists at subpathremove in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set once the Directory has been removedpublic Future<Boolean> removeIfExists(TransactionContext tcx)
DirectoryDirectory and all of its subdirectories, as well as all of their contents.
Warning: Clients that have already opened the directory might still insert data into its contents after it is removed.
removeIfExists in interface Directorytcx - the TransactionContext to execute this operation inFuture which will be set to true once this Directory has been removed,
or false if it didn't exist.public Future<Boolean> removeIfExists(TransactionContext tcx, List<String> subpath)
DirectoryDirectory located at subpath and all of its subdirectories,
as well as all of their contents.
Warning: Clients that have already opened the directory might still insert data into its contents after it is removed.
removeIfExists in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set to true once the Directory has been removed,
or false if it didn't exist.public Future<Boolean> exists(ReadTransactionContext tcx)
DirectoryDirectory exists.exists in interface Directorytcx - the ReadTransactionContext to execute this operation inFuture which will be set to true if this Directory exists, or false if it
doesn'tpublic Future<Boolean> exists(ReadTransactionContext tcx, List<String> subpath)
DirectoryDirectory located at subpath exists.exists in interface Directorytcx - the TransactionContext to execute this operation insubpath - a List<String> specifying a subpath of this DirectoryFuture which will be set to true if the specified subdirectory exists, or false if it
doesn't