Interface Directory
-
- All Known Implementing Classes:
DirectoryLayer,DirectorySubspace
public interface DirectoryRepresents a directory in theDirectoryLayer. ADirectorystores the path at which it is located and the layer that was used to create it. TheDirectoryinterface contains methods to operate on itself and its subdirectories.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.concurrent.CompletableFuture<DirectorySubspace>create(TransactionContext tcx, java.util.List<java.lang.String> subpath)Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).default java.util.concurrent.CompletableFuture<DirectorySubspace>create(TransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer)Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).java.util.concurrent.CompletableFuture<DirectorySubspace>create(TransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer, byte[] prefix)Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).default java.util.concurrent.CompletableFuture<DirectorySubspace>createOrOpen(TransactionContext tcx, java.util.List<java.lang.String> subpath)Creates or opens the subdirectory of thisDirectorylocated atsubpath(creating parent directories, if necessary).java.util.concurrent.CompletableFuture<DirectorySubspace>createOrOpen(TransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer)Creates or opens the subdirectory of thisDirectorylocated atsubpath(creating parent directories, if necessary).default java.util.concurrent.CompletableFuture<java.lang.Boolean>exists(ReadTransactionContext tcx)Checks if thisDirectoryexists.java.util.concurrent.CompletableFuture<java.lang.Boolean>exists(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath)Checks if the subdirectory of thisDirectorylocated atsubpathexists.DirectoryLayergetDirectoryLayer()Get theDirectoryLayerthat was used to create thisDirectory.byte[]getLayer()Gets the layer byte string that was stored when thisDirectorywas created.java.util.List<java.lang.String>getPath()Gets the path represented by thisDirectory.default java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>>list(ReadTransactionContext tcx)List the subdirectories of this directory.java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>>list(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath)List the subdirectories of this directory at a givensubpath.java.util.concurrent.CompletableFuture<DirectorySubspace>move(TransactionContext tcx, java.util.List<java.lang.String> oldSubpath, java.util.List<java.lang.String> newSubpath)Moves the subdirectory of thisDirectorylocated atoldSubpathtonewSubpath.java.util.concurrent.CompletableFuture<DirectorySubspace>moveTo(TransactionContext tcx, java.util.List<java.lang.String> newAbsolutePath)Moves thisDirectoryto the specifiednewAbsolutePath.default java.util.concurrent.CompletableFuture<DirectorySubspace>open(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath)Opens the subdirectory of thisDirectorylocated atsubpath.java.util.concurrent.CompletableFuture<DirectorySubspace>open(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer)Opens the subdirectory of thisDirectorylocated atsubpath.default java.util.concurrent.CompletableFuture<java.lang.Void>remove(TransactionContext tcx)Removes thisDirectoryand all of its subdirectories, as well as all of their contents.java.util.concurrent.CompletableFuture<java.lang.Void>remove(TransactionContext tcx, java.util.List<java.lang.String> subpath)Removes the subdirectory of thisDirectorylocated atsubpathand all of its subdirectories, as well as all of their contents.default java.util.concurrent.CompletableFuture<java.lang.Boolean>removeIfExists(TransactionContext tcx)Removes thisDirectoryand all of its subdirectories, as well as all of their contents.java.util.concurrent.CompletableFuture<java.lang.Boolean>removeIfExists(TransactionContext tcx, java.util.List<java.lang.String> subpath)Removes the subdirectory of thisDirectorylocated atsubpathand all of its subdirectories, as well as all of their contents.
-
-
-
Method Detail
-
getPath
java.util.List<java.lang.String> getPath()
Gets the path represented by thisDirectory.- Returns:
- this
Directory's path
-
getLayer
byte[] getLayer()
Gets the layer byte string that was stored when thisDirectorywas created.- Returns:
- this
Directory's layer byte string
-
getDirectoryLayer
DirectoryLayer getDirectoryLayer()
Get theDirectoryLayerthat was used to create thisDirectory.- Returns:
- the
DirectoryLayerthat created thisDirectory
-
createOrOpen
default java.util.concurrent.CompletableFuture<DirectorySubspace> createOrOpen(TransactionContext tcx, java.util.List<java.lang.String> subpath)
Creates or opens the subdirectory of thisDirectorylocated atsubpath(creating parent directories, if necessary).- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set to the created or openedDirectorySubspace
-
createOrOpen
java.util.concurrent.CompletableFuture<DirectorySubspace> createOrOpen(TransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer)
Creates or opens the subdirectory of thisDirectorylocated atsubpath(creating parent directories, if necessary). If the directory is new, then thelayerbyte string will be recorded as its layer. If the directory already exists, thelayerbyte string will be compared against thelayerset when the directory was created.The returned
CompletableFuturecan be set to the following errors:MismatchedLayerException- if the directory has already been created with a differentlayerbyte string
- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectorylayer- abyte[]specifying a layer to set on a new directory or check for on an existing directory- Returns:
- a
CompletableFuturewhich will be set to the created or openedDirectorySubspace
-
open
default java.util.concurrent.CompletableFuture<DirectorySubspace> open(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath)
Opens the subdirectory of thisDirectorylocated atsubpath.The returned
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if the directory does not exist
- Parameters:
tcx- theReadTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set to the openedDirectorySubspace
-
open
java.util.concurrent.CompletableFuture<DirectorySubspace> open(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer)
Opens the subdirectory of thisDirectorylocated atsubpath. Thelayerbyte string will be compared against thelayerset when the directory was created.The returned
CompletableFuturecan be set to the following errors:MismatchedLayerException- if the directory was created with a differentlayerbyte stringNoSuchDirectoryException- if the directory does not exist
- Parameters:
tcx- theReadTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectorylayer- abyte[]specifying the expected layer- Returns:
- a
CompletableFuturewhich will be set to the openedDirectorySubspace
-
create
default java.util.concurrent.CompletableFuture<DirectorySubspace> create(TransactionContext tcx, java.util.List<java.lang.String> subpath)
Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).The returned
CompletableFuturecan be set to the following errors:DirectoryAlreadyExistsException- if the given directory already exists
- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set to the createdDirectorySubspace
-
create
default java.util.concurrent.CompletableFuture<DirectorySubspace> create(TransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer)
Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary). Thelayerbyte string will be recorded as the new directory's layer and checked by future calls toopen(ReadTransactionContext, List, byte[]).The returned
CompletableFuturecan be set to the following errors:DirectoryAlreadyExistsException- if the given directory already exists
- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectorylayer- abyte[]specifying a layer to set for the directory- Returns:
- a
CompletableFuturewhich will be set to the createdDirectorySubspace
-
create
java.util.concurrent.CompletableFuture<DirectorySubspace> create(TransactionContext tcx, java.util.List<java.lang.String> subpath, byte[] layer, byte[] prefix)
Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary). Thelayerbyte string will be recorded as the new directory's layer and checked by future calls toopen(ReadTransactionContext, List, byte[]). The specifiedprefixwill be used for this directory's contents instead of allocating a prefix automatically.The returned
CompletableFuturecan be set to the following errors:DirectoryAlreadyExistsException- if the given directory already exists
- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectorylayer- abyte[]specifying a layer to set for the directoryprefix- abyte[]specifying the key prefix to use for the directory's contents- Returns:
- a
CompletableFuturewhich will be set to the createdDirectorySubspace
-
moveTo
java.util.concurrent.CompletableFuture<DirectorySubspace> moveTo(TransactionContext tcx, java.util.List<java.lang.String> newAbsolutePath)
Moves thisDirectoryto the specifiednewAbsolutePath.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:
- A location where a directory already exists
- A location whose parent does not exist
- A subdirectory of itself
- A different partition
The returned
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if thisDirectorydoesn't existDirectoryAlreadyExistsException- if a directory already exists atnewAbsolutePathDirectoryMoveException- if an invalid move location is specified
- Parameters:
tcx- theTransactionContextto execute this operation innewAbsolutePath- aList<String>specifying the new absolute path for thisDirectory- Returns:
- a
CompletableFuturewhich will be set to theDirectorySubspacefor thisDirectoryat its new location.
-
move
java.util.concurrent.CompletableFuture<DirectorySubspace> move(TransactionContext tcx, java.util.List<java.lang.String> oldSubpath, java.util.List<java.lang.String> newSubpath)
Moves the subdirectory of thisDirectorylocated atoldSubpathtonewSubpath.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:
- A location where a directory already exists
- A location whose parent does not exist
- A subdirectory of itself
- A different partition
The returned
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if noDirectoryexists atoldSubpathDirectoryAlreadyExistsException- if a directory already exists atnewSubpathDirectoryMoveException- if an invalid move location is specified
- Parameters:
tcx- theTransactionContextto execute this operation inoldSubpath- aList<String>specifying the subpath of the directory to movenewSubpath- aList<String>specifying the subpath to move to- Returns:
- a
CompletableFuturewhich will be set to theDirectorySubspacefor thisDirectoryat its new location.
-
remove
default java.util.concurrent.CompletableFuture<java.lang.Void> remove(TransactionContext tcx)
Removes thisDirectoryand all of its subdirectories, as well as all of their contents. This should not be called on the root directory, or it will result in the returned future being set to aDirectoryException.Warning: Clients that have already opened the directory might still insert data into its contents after it is removed.
The returned
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if thisDirectorydoesn't existDirectoryException- if this is called on the root directory
- Parameters:
tcx- theTransactionContextto execute this operation in- Returns:
- a
CompletableFuturewhich will be set once thisDirectoryhas been removed
-
remove
java.util.concurrent.CompletableFuture<java.lang.Void> remove(TransactionContext tcx, java.util.List<java.lang.String> subpath)
Removes the subdirectory of thisDirectorylocated atsubpathand 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
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if no directory exists atsubpath
- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set once theDirectoryhas been removed
-
removeIfExists
default java.util.concurrent.CompletableFuture<java.lang.Boolean> removeIfExists(TransactionContext tcx)
Removes thisDirectoryand 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.
- Parameters:
tcx- theTransactionContextto execute this operation in- Returns:
- a
CompletableFuturewhich will be set to true once thisDirectoryhas been removed, or false if it didn't exist.
-
removeIfExists
java.util.concurrent.CompletableFuture<java.lang.Boolean> removeIfExists(TransactionContext tcx, java.util.List<java.lang.String> subpath)
Removes the subdirectory of thisDirectorylocated atsubpathand 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.
- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set to true once theDirectoryhas been removed, or false if it didn't exist.
-
list
default java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> list(ReadTransactionContext tcx)
List the subdirectories of this directory.The returned
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if thisDirectorydoesn't exists
- Parameters:
tcx- theReadTransactionContextto execute this operation in- Returns:
- a
CompletableFuturewhich will be set to aList<String>of names of the subdirectories of thisDirectory. Each name is a unicode string representing the last component of a subdirectory's path.
-
list
java.util.concurrent.CompletableFuture<java.util.List<java.lang.String>> list(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath)
List the subdirectories of this directory at a givensubpath.The returned
CompletableFuturecan be set to the following errors:NoSuchDirectoryException- if no directory exists atsubpath
- Parameters:
tcx- theReadTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set to aList<String>of names of the subdirectories of the directory atsubpath. Each name is a unicode string representing the last component of a subdirectory's path.
-
exists
default java.util.concurrent.CompletableFuture<java.lang.Boolean> exists(ReadTransactionContext tcx)
Checks if thisDirectoryexists.- Parameters:
tcx- theReadTransactionContextto execute this operation in- Returns:
- a
CompletableFuturewhich will be set totrueif thisDirectoryexists, orfalseif it doesn't
-
exists
java.util.concurrent.CompletableFuture<java.lang.Boolean> exists(ReadTransactionContext tcx, java.util.List<java.lang.String> subpath)
Checks if the subdirectory of thisDirectorylocated atsubpathexists.- Parameters:
tcx- theTransactionContextto execute this operation insubpath- aList<String>specifying a subpath of thisDirectory- Returns:
- a
CompletableFuturewhich will be set totrueif the specified subdirectory exists, orfalseif it doesn't
-
-