Class ScopedDirectoryLayer
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.keyspace.LocatableResolver
-
- com.apple.foundationdb.record.provider.foundationdb.keyspace.ScopedDirectoryLayer
-
@API(MAINTAINED) public class ScopedDirectoryLayer extends LocatableResolver
An implementation ofLocatableResolver
that uses the FDB directory layer to keep track of the allocation of strings to integers. TheKeySpacePath
that it is created with will be the root where the node subspace of the directory layer is located.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.apple.foundationdb.record.provider.foundationdb.keyspace.LocatableResolver
LocatableResolver.LocatableResolverLockedException
-
-
Field Summary
-
Fields inherited from class com.apple.foundationdb.record.provider.foundationdb.keyspace.LocatableResolver
database, hashCode, location
-
-
Constructor Summary
Constructors Constructor Description ScopedDirectoryLayer(FDBDatabase database, ResolvedKeySpacePath path)
Create a scoped directory layer.ScopedDirectoryLayer(FDBRecordContext context, KeySpacePath path)
Deprecated.
-
Method Summary
-
Methods inherited from class com.apple.foundationdb.record.provider.foundationdb.keyspace.LocatableResolver
create, disableWriteLock, enableWriteLock, equals, exclusiveLock, getBaseSubspace, getDatabase, getMappingSubspace, getVersion, hashCode, incrementVersion, mustResolve, mustResolveWithMetadata, resolve, resolve, resolve, resolve, resolve, resolve, resolveWithMetadata, resolveWithMetadata, resolveWithMetadata, retired, retiredSkipCache, retireLayer, reverseLookup, setMapping, toString, updateMetadataAndVersion, wrap
-
-
-
-
Constructor Detail
-
ScopedDirectoryLayer
@Deprecated @API(DEPRECATED) public ScopedDirectoryLayer(@Nonnull FDBRecordContext context, @Nonnull KeySpacePath path)
Deprecated.Creates a scoped directory layer.- Parameters:
context
- a context that is used only during the construction of this scope in order to resolve the provided path into a subspacepath
- the path at which the directory layer should live
-
ScopedDirectoryLayer
public ScopedDirectoryLayer(@Nonnull FDBDatabase database, @Nonnull ResolvedKeySpacePath path)
Create a scoped directory layer.- Parameters:
database
- database that will be used when resolving valuespath
- the path at which the directory layer should store its mappings.
-
-
Method Detail
-
global
public static ScopedDirectoryLayer global(@Nonnull FDBDatabase database)
Creates a default instance of the scoped directory layer. This is aLocatableResolver
that is backed by the default instance of the FDB directory layer.- Parameters:
database
- theFDBDatabase
for this resolver- Returns:
- the global
ScopedDirectoryLayer
for this database
-
create
protected CompletableFuture<ResolverResult> create(@Nonnull FDBRecordContext context, @Nonnull String key, @Nullable byte[] metadata)
- Specified by:
create
in classLocatableResolver
-
read
protected CompletableFuture<Optional<ResolverResult>> read(@Nonnull FDBRecordContext context, String key)
- Specified by:
read
in classLocatableResolver
-
readReverse
protected CompletableFuture<Optional<String>> readReverse(FDBStoreTimer timer, Long value)
- Specified by:
readReverse
in classLocatableResolver
-
setMapping
public CompletableFuture<Void> setMapping(FDBRecordContext context, String key, ResolverResult value)
- Specified by:
setMapping
in classLocatableResolver
-
updateMetadata
public CompletableFuture<Void> updateMetadata(FDBRecordContext context, String key, byte[] metadata)
- Specified by:
updateMetadata
in classLocatableResolver
-
setWindow
public CompletableFuture<Void> setWindow(long count)
- Specified by:
setWindow
in classLocatableResolver
-
getMappingSubspaceAsync
@Nonnull public CompletableFuture<Subspace> getMappingSubspaceAsync()
Description copied from class:LocatableResolver
Get aCompletableFuture
that will contain theSubspace
where this resolver stores the mappings fromkey
String
s tovalue
Long
. Direct access to this subspace is not needed by general users and extreme care should be taken when interacting with it.- Specified by:
getMappingSubspaceAsync
in classLocatableResolver
- Returns:
- a future that, when ready, will hold the mapping subspace
-
getStateSubspaceAsync
protected CompletableFuture<Subspace> getStateSubspaceAsync()
- Specified by:
getStateSubspaceAsync
in classLocatableResolver
-
deserializeValue
@Nonnull public ResolverResult deserializeValue(byte[] value)
Description copied from class:LocatableResolver
Deserialize the raw bytes value stored in the mapping subspace.- Specified by:
deserializeValue
in classLocatableResolver
- Parameters:
value
- raw value bytes.- Returns:
- the deserialized
ResolverResult
.
-
getBaseSubspaceAsync
@Nonnull public CompletableFuture<Subspace> getBaseSubspaceAsync()
Description copied from class:LocatableResolver
Get aCompletableFuture
that will contain theSubspace
this resolver is rooted at (e.g. the global resolverExtendedDirectoryLayer.global(FDBDatabase)
has a base subspace at the root of the FDB keyspace. Note that this is not the subspace where the resolver maintains its allocation keys (seeLocatableResolver.getMappingSubspaceAsync()
).- Specified by:
getBaseSubspaceAsync
in classLocatableResolver
- Returns:
- a future that, when ready, will hold the base subspace
-
getNodeSubspace
public CompletableFuture<Subspace> getNodeSubspace(FDBRecordContext context)
-
getContentSubspace
public Subspace getContentSubspace()
-
-