Interface Directory
- All Known Implementing Classes:
DirectoryLayer,DirectorySubspace
DirectoryLayer. A Directory stores the path
at which it is located and the layer that was used to create it.
The Directory interface contains methods to operate on itself and its
subdirectories.-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<DirectorySubspace>create(TransactionContext tcx, List<String> subpath) Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).default CompletableFuture<DirectorySubspace>create(TransactionContext tcx, List<String> subpath, byte[] layer) Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).create(TransactionContext tcx, List<String> subpath, byte[] layer, byte[] prefix) Creates a subdirectory of thisDirectorylocated atsubpath(creating parent directories if necessary).default CompletableFuture<DirectorySubspace>createOrOpen(TransactionContext tcx, List<String> subpath) Creates or opens the subdirectory of thisDirectorylocated atsubpath(creating parent directories, if necessary).createOrOpen(TransactionContext tcx, List<String> subpath, byte[] layer) Creates or opens the subdirectory of thisDirectorylocated atsubpath(creating parent directories, if necessary).default CompletableFuture<Boolean>Checks if thisDirectoryexists.exists(ReadTransactionContext tcx, List<String> subpath) Checks if the subdirectory of thisDirectorylocated atsubpathexists.Get theDirectoryLayerthat was used to create thisDirectory.byte[]getLayer()Gets the layer byte string that was stored when thisDirectorywas created.getPath()Gets the path represented by thisDirectory.default CompletableFuture<List<String>>List the subdirectories of this directory.list(ReadTransactionContext tcx, List<String> subpath) List the subdirectories of this directory at a givensubpath.Moves the subdirectory of thisDirectorylocated atoldSubpathtonewSubpath.moveTo(TransactionContext tcx, List<String> newAbsolutePath) Moves thisDirectoryto the specifiednewAbsolutePath.default CompletableFuture<DirectorySubspace>open(ReadTransactionContext tcx, List<String> subpath) Opens the subdirectory of thisDirectorylocated atsubpath.open(ReadTransactionContext tcx, List<String> subpath, byte[] layer) Opens the subdirectory of thisDirectorylocated atsubpath.default CompletableFuture<Void>remove(TransactionContext tcx) Removes thisDirectoryand all of its subdirectories, as well as all of their contents.remove(TransactionContext tcx, List<String> subpath) Removes the subdirectory of thisDirectorylocated atsubpathand all of its subdirectories, as well as all of their contents.default CompletableFuture<Boolean>Removes thisDirectoryand all of its subdirectories, as well as all of their contents.removeIfExists(TransactionContext tcx, List<String> subpath) Removes the subdirectory of thisDirectorylocated atsubpathand all of its subdirectories, as well as all of their contents.
-
Method Details
-
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 CompletableFuture<DirectorySubspace> createOrOpen(TransactionContext tcx, List<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
CompletableFuture<DirectorySubspace> createOrOpen(TransactionContext tcx, List<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
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
CompletableFuture<DirectorySubspace> open(ReadTransactionContext tcx, List<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
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 CompletableFuture<DirectorySubspace> create(TransactionContext tcx, List<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
CompletableFuture<DirectorySubspace> create(TransactionContext tcx, List<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
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
CompletableFuture<DirectorySubspace> move(TransactionContext tcx, List<String> oldSubpath, List<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
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
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
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
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
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
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
Checks if thisDirectoryexists.- Parameters:
tcx- theReadTransactionContextto execute this operation in- Returns:
- a
CompletableFuturewhich will be set totrueif thisDirectoryexists, orfalseif it doesn't
-
exists
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
-