@API(value=MAINTAINED) public interface KeySpacePath
KeySpacePath
represents a discrete path through a directory tree defined by a KeySpace
.
A KeySpacePath
is started via KeySpace.path(String)
,
and a specific path may be traced down through the directory structure via successive calls to
add(String, Object)
. Once a desired path has been fully constructed, toTuple(FDBRecordContext)
is used
to turn the resulting path into a Tuple
to represent the FDB row key.Modifier and Type | Method and Description |
---|---|
KeySpacePath |
add(String dirName)
Adds the constant value for subdirectory
dirName to the directory path. |
KeySpacePath |
add(String dirName,
Object value)
Adds a
value for a specific subdirectory dirName to the directory path. |
default void |
deleteAllData(FDBRecordContext context)
Synchronous version of
deleteAllDataAsync(FDBRecordContext) . |
CompletableFuture<Void> |
deleteAllDataAsync(FDBRecordContext context)
Delete all data from this path.
|
List<KeySpacePath> |
flatten()
Flattens the path into a list of
KeySpacePath entries, with the root of the path
located at position 0. |
KeySpaceDirectory |
getDirectory()
Returns the directory that corresponds to this path entry.
|
String |
getDirectoryName()
Returns the directory name for this path element.
|
KeySpacePath |
getParent()
Returns the parent of this entry or null if this is the root of the path.
|
Tuple |
getRemainder()
Deprecated.
|
PathValue |
getStoredValue()
Deprecated.
|
Object |
getValue()
Returns the value that was provided when to
add(String, Object) when this path was constructed. |
default boolean |
hasData(FDBRecordContext context)
Synchronous version of
hasDataAsync(FDBRecordContext) . |
CompletableFuture<Boolean> |
hasDataAsync(FDBRecordContext context)
Check whether data exists for this path.
|
boolean |
hasStoredValue()
Deprecated.
use
KeySpace.resolveFromKey(FDBRecordContext, Tuple) instead |
default List<KeySpacePath> |
list(FDBRecordContext context,
String subdirName)
Deprecated.
use
listSubdirectory(FDBRecordContext, String) instead |
default List<KeySpacePath> |
list(FDBRecordContext context,
String subdirName,
ScanProperties scanProperties)
Deprecated.
|
default List<KeySpacePath> |
list(FDBRecordContext context,
String subdirName,
ValueRange<?> range,
byte[] continuation,
ScanProperties scanProperties)
Deprecated.
|
default RecordCursor<KeySpacePath> |
listAsync(FDBRecordContext context,
String subdirName,
byte[] continuation,
ScanProperties scanProperties)
Deprecated.
|
RecordCursor<KeySpacePath> |
listAsync(FDBRecordContext context,
String subdirName,
ValueRange<?> range,
byte[] continuation,
ScanProperties scanProperties)
Deprecated.
|
default List<ResolvedKeySpacePath> |
listSubdirectory(FDBRecordContext context,
String subdirName)
Synchronous/blocking version of
listSubdirectoryAsync . |
default List<ResolvedKeySpacePath> |
listSubdirectory(FDBRecordContext context,
String subdirName,
ScanProperties scanProperties)
Synchronous/blocking version of
listSubdirectoryAsync . |
default List<ResolvedKeySpacePath> |
listSubdirectory(FDBRecordContext context,
String subdirName,
ValueRange<?> range,
byte[] continuation,
ScanProperties scanProperties)
Synchronous/blocking version of
listSubdirectoryAsync . |
default List<ResolvedKeySpacePath> |
listSubdirectory(FDBRecordContext context,
String subdirName,
ValueRange<?> range,
ScanProperties scanProperties)
Synchronous/blocking version of
listSubdirectoryAsync . |
default RecordCursor<ResolvedKeySpacePath> |
listSubdirectoryAsync(FDBRecordContext context,
String subdirName,
byte[] continuation,
ScanProperties scanProperties)
For a given subdirectory from this path element, return a list of paths for all available keys in the FDB
keyspace for that directory.
|
RecordCursor<ResolvedKeySpacePath> |
listSubdirectoryAsync(FDBRecordContext context,
String subdirName,
ValueRange<?> range,
byte[] continuation,
ScanProperties scanProperties)
For a given subdirectory from this path element, return a list of paths for all available keys in the FDB
keyspace for that directory.
|
CompletableFuture<PathValue> |
resolveAsync(FDBRecordContext context)
Retrieve the value that is to be stored for this directory entry.
|
default int |
size()
Get the length of the path.
|
default ResolvedKeySpacePath |
toResolvedPath(FDBRecordContext context)
Resolves the path into a
ResolvedKeySpacePath , a form the retains all of the information about
the path itself along with the value to which each path entry is resolved. |
CompletableFuture<ResolvedKeySpacePath> |
toResolvedPathAsync(FDBRecordContext context)
Resolves the path into a
ResolvedKeySpacePath , a form the retains all of the information about
the path itself along with the value to which each path entry is resolved. |
String |
toString(Tuple tuple)
String representation of this
KeySpacePath that shows correspondences between original and resolved
directory values in accordance with the input Tuple . |
default Subspace |
toSubspace(FDBRecordContext context)
Converts the tuple produced for this path to a subspace.
|
default CompletableFuture<Subspace> |
toSubspaceAsync(FDBRecordContext context)
Converts the tuple produced for this path to a subspace.
|
default Tuple |
toTuple(FDBRecordContext context)
Converts this path into a tuple.
|
CompletableFuture<Tuple> |
toTupleAsync(FDBRecordContext context)
Converts this path into a tuple.
|
default int size()
@Nonnull KeySpacePath add(@Nonnull String dirName)
dirName
to the directory path.dirName
- the name of the subdirectory to add to the pathNoSuchDirectoryException
- if the specified subdirectory does not existRecordCoreArgumentException
- if the subdirectory does not have a constant value@Nonnull KeySpacePath add(@Nonnull String dirName, @Nullable Object value)
value
for a specific subdirectory dirName
to the directory path.dirName
- the name of the subdirectory to add to the pathvalue
- the value to use for the subdirectoryNoSuchDirectoryException
- if the specified subdirectory does not existRecordCoreArgumentException
- if the type of the value is not appropriate for the
provided directory or differs from the constant value specified for the directory@API(value=DEPRECATED) @Deprecated @Nullable Tuple getRemainder()
KeySpace.resolveFromKey(FDBRecordContext, Tuple)
and
ResolvedKeySpacePath.getRemainder()
insteadKeySpace.pathFromKey(FDBRecordContext, Tuple)
, this returns
any remaining portion of the input tuple that was not used to construct the path.null
@Nullable KeySpacePath getParent()
@Nonnull String getDirectoryName()
@Nonnull KeySpaceDirectory getDirectory()
@Nullable Object getValue()
add(String, Object)
when this path was constructed.
Note that for some directory types, such as DirectoryLayerDirectory
, this may not be the value
that is actually stored at this path element. For that, use resolveAsync(FDBRecordContext)
.@Nonnull CompletableFuture<PathValue> resolveAsync(@Nonnull FDBRecordContext context)
DirectoryLayerDirectory
the value returned will be the number assigned
by the directory layer for this path entry's value.context
- the context in which to resolve the valueKeySpace.pathFromKeyAsync(FDBRecordContext, Tuple)
or listAsync(FDBRecordContext, String, byte[], ScanProperties)
,
then the future that is returned will have already been completed (i.e it is safe to retrieve the
value without blocking)@API(value=DEPRECATED) @Deprecated @Nonnull PathValue getStoredValue()
KeySpace.resolveFromKey(FDBRecordContext, Tuple)
and
ResolvedKeySpacePath.getResolvedPathValue()
insteadpathFromKey
or listAsync
(or their blocking
variants), this method may be used to determine what the underlying value was physically stored in the key.IllegalStateException
- if this path element was not produced from one of the above method calls@API(value=DEPRECATED) @Deprecated boolean hasStoredValue()
KeySpace.resolveFromKey(FDBRecordContext, Tuple)
insteadgetStoredValue()
.@Nonnull default Tuple toTuple(@Nonnull FDBRecordContext context)
context
- the context in which to resolve the pathRecordCoreArgumentException
- if the value generated for a position in the path is not valid for
that particular position@Nonnull CompletableFuture<Tuple> toTupleAsync(@Nonnull FDBRecordContext context)
context
- the context in which the path is to be resolved@Nonnull CompletableFuture<ResolvedKeySpacePath> toResolvedPathAsync(@Nonnull FDBRecordContext context)
ResolvedKeySpacePath
, a form the retains all of the information about
the path itself along with the value to which each path entry is resolved.context
- the context in which the path is to be resolved@Nonnull default ResolvedKeySpacePath toResolvedPath(@Nonnull FDBRecordContext context)
ResolvedKeySpacePath
, a form the retains all of the information about
the path itself along with the value to which each path entry is resolved.context
- the context in which the path is to be resolveddefault Subspace toSubspace(FDBRecordContext context)
context
- the context in which to resolve the path@Nonnull default CompletableFuture<Subspace> toSubspaceAsync(@Nonnull FDBRecordContext context)
context
- the context in which to resolve the path@Nonnull List<KeySpacePath> flatten()
KeySpacePath
entries, with the root of the path
located at position 0.@Nonnull CompletableFuture<Boolean> hasDataAsync(FDBRecordContext context)
context
- the context in which the path is resolved and a scan is performed looking for datatrue
if data exists for this pathdefault boolean hasData(@Nonnull FDBRecordContext context)
hasDataAsync(FDBRecordContext)
.context
- the context in which the path is resolved and a scan is performed looking for datatrue
if data exists for this path@Nonnull CompletableFuture<Void> deleteAllDataAsync(@Nonnull FDBRecordContext context)
context
- the context in which the path is resolved and the delete operation takes placedefault void deleteAllData(@Nonnull FDBRecordContext context)
deleteAllDataAsync(FDBRecordContext)
.context
- the context in which the path is resolved and the delete operation takes place@API(value=DEPRECATED) @Deprecated @Nonnull default RecordCursor<KeySpacePath> listAsync(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
listSubdirectoryAsync(FDBRecordContext, String, byte[], ScanProperties)
insteadroot +- node +- leafPerforming a
listAsync
from a given node
, will result in a list of paths, one for
each leaf
that is available within the node
's scope.
The listing is performed by reading the first key of the data type (and possibly constant value) for the
subdirectory and, if a key is found, skipping to the next available value after the first one that was found,
and so on, each time resulting in an additional KeySpacePath
that is returned. In each case,
the returned KeySpacePath
may contain a remainder (see getRemainder()
) of the portion
of the key tuple that was read.
context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedcontinuation
- an optional continuation from a previous list attemptscanProperties
- details for how the scan should be performedNoSuchDirectoryException
- if the subdirectory name provided does not existRecordCoreException
- if a key found during the listing process did not correspond to
the directory tree@API(value=DEPRECATED) @Deprecated @Nonnull RecordCursor<KeySpacePath> listAsync(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable ValueRange<?> range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
listSubdirectoryAsync(FDBRecordContext, String, ValueRange, byte[], ScanProperties)
insteadroot +- node +- leafPerforming a
listAsync
from a given node
, will result in a list of paths, one for
each leaf
that is available within the node
's scope.
The listing is performed by reading the first key of the data type (and possibly constant value) for the
subdirectory and, if a key is found, skipping to the next available value after the first one that was found,
and so on, each time resulting in an additional KeySpacePath
that is returned. In each case,
the returned KeySpacePath
may contain a remainder (see getRemainder()
) of the portion
of the key tuple that was read.
context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedrange
- the range of the subdirectory values to be listed. All will be listed if it is null
.
If the directory is restricted to a specific constant value, it has to be null
continuation
- an optional continuation from a previous list attemptscanProperties
- details for how the scan should be performedNoSuchDirectoryException
- if the subdirectory name provided does not existRecordCoreException
- if a key found during the listing process did not correspond to
the directory tree@API(value=DEPRECATED) @Deprecated @Nonnull default List<KeySpacePath> list(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nonnull ScanProperties scanProperties)
listSubdirectory(FDBRecordContext, String, ScanProperties)
insteadlistAsync
.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedscanProperties
- details for how the scan should be performed@API(value=DEPRECATED) @Deprecated @Nonnull default List<KeySpacePath> list(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable ValueRange<?> range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
listSubdirectory(FDBRecordContext, String, ValueRange, byte[], ScanProperties)
insteadlistAsync
.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedrange
- the range of the subdirectory values to be listed. All will be listed if it is null
.
If the directory is restricted to a specific constant value, it has to be null
continuation
- an optional continuation from a previous list attemptscanProperties
- details for how the scan should be performed@API(value=DEPRECATED) @Deprecated @Nonnull default List<KeySpacePath> list(@Nonnull FDBRecordContext context, @Nonnull String subdirName)
listSubdirectory(FDBRecordContext, String)
insteadlistAsync
that performs a forward, serializable scan.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listed@Nonnull RecordCursor<ResolvedKeySpacePath> listSubdirectoryAsync(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable ValueRange<?> range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
root +- dirA +- dirB +- dirCPerforming a
listSubdirectoryAsync
from dirA
for subdirectory dirB
will path to each distinct value of dirB
.
The listing is performed by reading the first key of the data type (and possibly constant value) for the
subdirectory and, if a key is found, skipping to the next available value after the first one that was found,
and so on, each time resulting in an additional ResolvedKeySpacePath
that is returned. In each case,
the returned ResolvedKeySpacePath
may contain a remainder (see ResolvedKeySpacePath.getRemainder()
)
of the portion of the key tuple that was read. In the above example, each unique value of dirB
would contain a remainder Tuple
of the first value of dirC
.
context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedrange
- the range of the subdirectory values to be listed. All will be listed if it is null
.
If the directory is restricted to a specific constant value, it has to be null
continuation
- an optional continuation from a previous list attemptscanProperties
- details for how the scan should be performedNoSuchDirectoryException
- if the subdirectory name provided does not existRecordCoreException
- if a key found during the listing process did not correspond to
the directory tree@Nonnull default RecordCursor<ResolvedKeySpacePath> listSubdirectoryAsync(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
root +- dirA +- dirB +- dirCPerforming a
listSubdirectoryAsync
from dirA
for subdirectory dirB
will path to each distinct value of dirB
.
The listing is performed by reading the first key of the data type (and possibly constant value) for the
subdirectory and, if a key is found, skipping to the next available value after the first one that was found,
and so on, each time resulting in an additional ResolvedKeySpacePath
that is returned. In each case,
the returned ResolvedKeySpacePath
may contain a remainder (see ResolvedKeySpacePath.getRemainder()
)
of the portion of the key tuple that was read. In the above example, each unique value of dirB
would contain a remainder Tuple
of the first value of dirC
.
context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedcontinuation
- an optional continuation from a previous list attemptscanProperties
- details for how the scan should be performedNoSuchDirectoryException
- if the subdirectory name provided does not existRecordCoreException
- if a key found during the listing process did not correspond to
the directory tree@Nonnull default List<ResolvedKeySpacePath> listSubdirectory(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable ValueRange<?> range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
listSubdirectoryAsync
.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedrange
- the range of the subdirectory values to be listed. All will be listed if it is null
.
If the directory is restricted to a specific constant value, it has to be null
continuation
- an optional continuation from a previous list attemptscanProperties
- details for how the scan should be performed@Nonnull default List<ResolvedKeySpacePath> listSubdirectory(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nullable ValueRange<?> range, @Nonnull ScanProperties scanProperties)
listSubdirectoryAsync
.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedrange
- the range of the subdirectory values to be listed. All will be listed if it is null
.
If the directory is restricted to a specific constant value, it has to be null
scanProperties
- details for how the scan should be performed@Nonnull default List<ResolvedKeySpacePath> listSubdirectory(@Nonnull FDBRecordContext context, @Nonnull String subdirName, @Nonnull ScanProperties scanProperties)
listSubdirectoryAsync
.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listedscanProperties
- details for how the scan should be performed@Nonnull default List<ResolvedKeySpacePath> listSubdirectory(@Nonnull FDBRecordContext context, @Nonnull String subdirName)
listSubdirectoryAsync
.context
- the transaction in which to perform the listingsubdirName
- the name of the subdirectory that is to be listed@API(value=UNSTABLE) String toString(@Nonnull Tuple tuple)
KeySpacePath
that shows correspondences between original and resolved
directory values in accordance with the input Tuple
.tuple
- representing the directory values of this path in resolved form