SubspaceLocation<TSubspace>

Namespace: FoundationDB.Client · class

Implements: ISubspaceLocation<TSubspace>, ISubspaceLocation, IEquatable<ISubspaceLocation>, IFdbLayer<TSubspace, FdbDirectoryLayer>, IFdbLayer

Default implementation of a subspace location

Properties

IsTopLevel

bool IsTopLevel { get; }

Path

FdbPath Path { get; }

Path of the directory subspace that contains the subspace.

This path is always absolute. Relative paths are not allowed. Can be if this subspace is located at the root of the database (ie: not using the Directory Layer)

Prefix

Slice Prefix { get; }

Optional key prefix of the subspace, added immediately after the prefix of the subspace resolved by the Path.

Methods

Equals

bool Equals(object obj)

bool Equals(ISubspaceLocation other)

GetHashCode

int GetHashCode()

Resolve

ValueTask<TSubspace> Resolve(IFdbReadOnlyTransaction tr, FdbDirectoryLayer directory = null)

Returns the actual subspace that corresponds to this location, or throws if it does not exist.

  • tr — Current transaction
  • directoryDirectoryLayer instance to use for the resolve. If null, uses the default database directory layer.

Returns: Key subspace using the resolved key prefix of this location in the context of the current transaction

The instance resolved for this transaction SHOULD NOT be used in the context of a different transaction, because its location in the Directory Layer may have been changed concurrently!

Re-using cached subspace instances MAY lead to DATA CORRUPTION if not used carefully! The best practice is to call Resolve() every time it is needed by a new transaction.

ToString

string ToString()

TryResolve

ValueTask<TSubspace> TryResolve(IFdbReadOnlyTransaction tr, FdbDirectoryLayer directory = null)

Returns the actual subspace that corresponds to this location, if it exists.

  • tr — Current transaction
  • directoryDirectoryLayer instance to use for the resolve. If null, uses the default database directory layer.

Returns: Key subspace using the resolved key prefix of this location in the context of the current transaction, or null if the directory does not exist

The instance resolved for this transaction SHOULD NOT be used in the context of a different transaction, because its location in the Directory Layer may have been changed concurrently!

Re-using cached subspace instances MAY lead to DATA CORRUPTION if not used carefully! The best practice is to call TryResolve() every time it is needed by a new transaction.