Fdb.System
Namespace: FoundationDB.Client · class
Helper class for reading from the reserved System subspace
Methods
ConfigKey
static Slice ConfigKey(Slice name)
Return the corresponding key for a config attribute
name— "foo"
Returns: "\xFF/conf/foo"
static Slice ConfigKey(string name)
Return the corresponding key for a config attribute
name— "foo"
Returns: "\xFF/conf/foo"
EstimateCountAsync
static Task<long> EstimateCountAsync(IFdbDatabase db, KeyRange range, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationrange— Range defining the keys to countct— Token used to cancel the operation
Returns: Number of keys k such that range.Begin <= k > range.End
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync<TKeyRange>(IFdbDatabase db, in TKeyRange range, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationrange— Range defining the keys to countct— Token used to cancel the operation
Returns: Number of keys k such that range.Begin <= k > range.End
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync(IFdbDatabaseProvider db, KeyRange range, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationrange— Range defining the keys to countct— Token used to cancel the operation
Returns: Number of keys k such that range.Begin <= k > range.End
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync(IFdbDatabase db, KeyRange range, IProgress<(long, Slice)> onProgress, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationrange— Range defining the keys to countonProgress— Optional callback called every time the count is updated. The first argument is the current count, and the second argument is the last key that was found.ct— Token used to cancel the operation
Returns: Number of keys k such that range.Begin <= k > range.End
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync<TKeyRange>(IFdbDatabase db, in TKeyRange range, IProgress<(long, Slice)> onProgress, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationrange— Range defining the keys to countonProgress— Optional callback called every time the count is updated. The first argument is the current count, and the second argument is the last key that was found.ct— Token used to cancel the operation
Returns: Number of keys k such that range.Begin <= k > range.End
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync(IFdbDatabaseProvider db, KeyRange range, IProgress<(long, Slice)> onProgress, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationrange— Range defining the keys to countonProgress— Optional callback called every time the count is updated. The first argument is the current count, and the second argument is the last key that was found.ct— Token used to cancel the operation
Returns: Number of keys k such that range.Begin <= k > range.End
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync(IFdbDatabase db, Slice beginInclusive, Slice endExclusive, IProgress<(long, Slice)> onProgress, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationbeginInclusive— Key defining the beginning of the rangeendExclusive— Key defining the end of the rangeonProgress— Optional callback called every time the count is updated. The first argument is the current count, and the second argument is the last key that was found.ct— Token used to cancel the operation
Returns: Number of keys k such that beginInclusive <= k > endExclusive
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
static Task<long> EstimateCountAsync(IFdbDatabaseProvider db, Slice beginInclusive, Slice endExclusive, IProgress<(long, Slice)> onProgress, CancellationToken ct)
Estimates the number of keys in the specified range.
db— Database used for the operationbeginInclusive— Key defining the beginning of the rangeendExclusive— Key defining the end of the rangeonProgress— Optional callback called every time the count is updated. The first argument is the current count, and the second argument is the last key that was found.ct— Token used to cancel the operation
Returns: Number of keys k such that beginInclusive <= k > endExclusive
If the range contains a large of number keys, the operation may need more than one transaction to complete, meaning that the number will not be transactionally accurate.
GetBoundaryKeysAsync
static Task<List<Slice>> GetBoundaryKeysAsync(IFdbReadOnlyTransaction trans, Slice beginInclusive, Slice endExclusive)
Returns a list of keys k such that beginInclusive <= k < endExclusive and k is located at the start of a contiguous range stored on a single server
trans— Transaction to use for the operationbeginInclusive— First key (inclusive) of the range to inspectendExclusive— End key (exclusive) of the range to inspect
Returns: List of keys that mark the start of a new chunk
This method is not transactional. It will return an answer no older than the Transaction object it is passed, but the returned boundaries are an estimate and may not represent the exact boundary locations at any database version.
static Task<List<Slice>> GetBoundaryKeysAsync(IFdbDatabase db, Slice beginInclusive, Slice endExclusive, CancellationToken ct)
Returns a list of keys k such that beginInclusive <= k < endExclusive and k is located at the start of a contiguous range stored on a single server
db— Database to use for the operationbeginInclusive— First key (inclusive) of the range to inspectendExclusive— End key (exclusive) of the range to inspectct— Token used to cancel the operation
Returns: List of keys that mark the start of a new chunk
This method is not transactional. It will return an answer no older than the Database object it is passed, but the returned boundaries are an estimate and may not represent the exact boundary locations at any database version.
static Task<List<Slice>> GetBoundaryKeysAsync(IFdbDatabaseProvider db, Slice beginInclusive, Slice endExclusive, CancellationToken ct)
Returns a list of keys k such that beginInclusive <= k < endExclusive and k is located at the start of a contiguous range stored on a single server
db— Database to use for the operationbeginInclusive— First key (inclusive) of the range to inspectendExclusive— End key (exclusive) of the range to inspectct— Token used to cancel the operation
Returns: List of keys that mark the start of a new chunk
This method is not transactional. It will return an answer no older than the Database object it is passed, but the returned boundaries are an estimate and may not represent the exact boundary locations at any database version.
GetChunksAsync
static Task<List<KeyRange>> GetChunksAsync(IFdbDatabase db, KeyRange range, CancellationToken ct)
Split a range of keys into smaller chunks where each chunk represents a contiguous range stored on a single server
db— Database to use for the operationrange— Range of keys to split up into smaller chunksct— Token used to cancel the operation
Returns: List of one or more chunks that constitutes the range, where each chunk represents a contiguous range stored on a single server. If the list contains a single range, that means that the range is small enough to fit inside a single chunk.
This method is not transactional. It will return an answer no older than the Database object it is passed, but the returned ranges are an estimate and may not represent the exact boundary locations at any database version.
static Task<List<KeyRange>> GetChunksAsync(IFdbDatabaseProvider db, KeyRange range, CancellationToken ct)
Split a range of keys into smaller chunks where each chunk represents a contiguous range stored on a single server
db— Database to use for the operationrange— Range of keys to split up into smaller chunksct— Token used to cancel the operation
Returns: List of one or more chunks that constitutes the range, where each chunk represents a contiguous range stored on a single server. If the list contains a single range, that means that the range is small enough to fit inside a single chunk.
This method is not transactional. It will return an answer no older than the Database object it is passed, but the returned ranges are an estimate and may not represent the exact boundary locations at any database version.
static Task<List<KeyRange>> GetChunksAsync(IFdbDatabase db, Slice beginInclusive, Slice endExclusive, CancellationToken ct)
Split a range of keys into chunks representing a contiguous range stored on a single server
db— Database to use for the operationbeginInclusive— First key (inclusive) of the range to inspectendExclusive— End key (exclusive) of the range to inspectct— Token used to cancel the operation
Returns: List of one or more chunks that constitutes the range, where each chunk represents a contiguous range stored on a single server. If the list contains a single range, that means that the range is small enough to fit inside a single chunk.
This method is not transactional. It will return an answer no older than the Database object it is passed, but the returned ranges are an estimate and may not represent the exact boundary locations at any database version.
static Task<List<KeyRange>> GetChunksAsync(IFdbDatabaseProvider db, Slice beginInclusive, Slice endExclusive, CancellationToken ct)
Split a range of keys into chunks representing a contiguous range stored on a single server
db— Database to use for the operationbeginInclusive— First key (inclusive) of the range to inspectendExclusive— End key (exclusive) of the range to inspectct— Token used to cancel the operation
Returns: List of one or more chunks that constitutes the range, where each chunk represents a contiguous range stored on a single server. If the list contains a single range, that means that the range is small enough to fit inside a single chunk.
This method is not transactional. It will return an answer no older than the Database object it is passed, but the returned ranges are an estimate and may not represent the exact boundary locations at any database version.
GetClientStatusAsync
static Task<FdbClientStatus> GetClientStatusAsync(IFdbDatabase db, CancellationToken ct)
Queries the current status of the client
Returns: Task that returns a FdbClientStatus instance that wraps the parsed JSON document.
Requires API version 730 or greater
static Task<FdbClientStatus> GetClientStatusAsync(IFdbDatabaseProvider db, CancellationToken ct)
Queries the current status of the client
Requires API version 730 or greater
GetConfigParameterAsync
static Task<Slice> GetConfigParameterAsync(IFdbDatabase db, Slice name, CancellationToken ct)
Returns the value of a configuration parameter (located under '\xFF/conf/')
db— Database to use for the operationname— Name of the configuration key (ex: "storage_engine")ct— Token used to cancel the operation
Returns: Value of '\xFF/conf/storage_engine'
static Task<Slice> GetConfigParameterAsync(IFdbDatabaseProvider db, Slice name, CancellationToken ct)
Returns the value of a configuration parameter (located under '\xFF/conf/')
db— Database to use for the operationname— Name of the configuration key (ex: "storage_engine")ct— Token used to cancel the operation
Returns: Value of '\xFF/conf/storage_engine'
static Task<Slice> GetConfigParameterAsync(IFdbDatabase db, string name, CancellationToken ct)
Returns the value of a configuration parameter (located under '\xFF/conf/')
db— Database to use for the operationname— Name of the configuration key (ex: "storage_engine")ct— Token used to cancel the operation
Returns: Value of '\xFF/conf/storage_engine'
static Task<Slice> GetConfigParameterAsync(IFdbDatabaseProvider db, string name, CancellationToken ct)
Returns the value of a configuration parameter (located under '\xFF/conf/')
db— Database to use for the operationname— Name of the configuration key (ex: "storage_engine")ct— Token used to cancel the operation
Returns: Value of '\xFF/conf/storage_engine'
GetCoordinatorsAsync
static Task<FdbClusterConnectionString> GetCoordinatorsAsync(IFdbReadOnlyTransaction tr)
Returns an object describing the list of the current coordinators for the cluster
tr— Transaction to use for the operation
Caution: This operation will set the ReadSystemKeys and PrioritySystemImmediate options on the transaction. You should avoid mixing this method and other read-heavy operations in the same transaction.
Since the list of coordinators may change at any time, the results may already be obsolete once this method completes!
static Task<FdbClusterConnectionString> GetCoordinatorsAsync(IFdbDatabase db, CancellationToken ct)
Returns an object describing the list of the current coordinators for the cluster
db— Database to use for the operationct— Token used to cancel the operation
Since the list of coordinators may change at any time, the results may already be obsolete once this method completes!
static Task<FdbClusterConnectionString> GetCoordinatorsAsync(IFdbDatabaseProvider db, CancellationToken ct)
Returns an object describing the list of the current coordinators for the cluster
db— Database Provider to use for the operationct— Token used to cancel the operation
Since the list of coordinators may change at any time, the results may already be obsolete once this method completes!
GetSpecialKeyAsync
static Task<Slice> GetSpecialKeyAsync(IFdbDatabase db, Slice name, CancellationToken ct)
Returns the value of a special key (located under the \xFF\xFF prefix)
db— Database to use for the operationname— Name of the special key (ex:`/management/tenant_mode`)ct— Token used to cancel the operation
Returns: Value of \xFF\xFF/management/tenant_mode
static Task<Slice> GetSpecialKeyAsync(IFdbDatabaseProvider db, Slice name, CancellationToken ct)
Returns the value of a special key (located under the \xFF\xFF prefix)
db— Database to use for the operationname— Name of the special key (ex:`/management/tenant_mode`)ct— Token used to cancel the operation
Returns: Value of \xFF\xFF/management/tenant_mode
static Task<Slice> GetSpecialKeyAsync(IFdbDatabase db, string name, CancellationToken ct)
Returns the value of a special key (located under the \xFF\xFF prefix)
db— Database to use for the operationname— Name of the special key (ex:"/management/tenant_mode")ct— Token used to cancel the operation
Returns: Value of \xFF\xFF/management/tenant_mode
static Task<Slice> GetSpecialKeyAsync(IFdbDatabaseProvider db, string name, CancellationToken ct)
Returns the value of a special key (located under the \xFF\xFF prefix)
db— Database to use for the operationname— Name of the special key (ex:`/management/tenant_mode`)ct— Token used to cancel the operation
Returns: Value of \xFF\xFF/management/tenant_mode
GetStatusAsync
static Task<FdbSystemStatus> GetStatusAsync(IFdbReadOnlyTransaction trans)
Query the current status of the cluster
Returns: Task that returns a FdbSystemStatus instance that wraps the parsed JSON document.
This method will read the `\xFF\xFF/status/json` special key, and parse the result JSON bytes.
static Task<FdbSystemStatus> GetStatusAsync(IFdbDatabase db, CancellationToken ct)
Queries the current status of the cluster
Returns: Task that returns a FdbSystemStatus instance that wraps the parsed JSON document.
This method will read the `\xFF\xFF/status/json` special key, and parse the result JSON bytes.
static Task<FdbSystemStatus> GetStatusAsync(IFdbDatabaseProvider db, CancellationToken ct)
Queries the current status of the cluster
Returns: Task that returns a FdbSystemStatus instance that wraps the parsed JSON document.
This method will read the `\xFF\xFF/status/json` special key, and parse the result JSON bytes.
GetStorageEngineModeAsync
static Task<string> GetStorageEngineModeAsync(IFdbDatabase db, CancellationToken ct)
Returns the current storage engine mode of the cluster
db— Database to use for the operationct— Token used to cancel the operation
Returns: Returns either "memory" or "ssd"
Will return a string starting with "unknown" if the storage engine mode is not recognized
static Task<string> GetStorageEngineModeAsync(IFdbDatabaseProvider db, CancellationToken ct)
Returns the current storage engine mode of the cluster
db— Database to use for the operationct— Token used to cancel the operation
Returns: Returns either "memory" or "ssd"
Will return a string starting with "unknown" if the storage engine mode is not recognized
GlobalsKey
static Slice GlobalsKey(string name)
Return the corresponding key for a global attribute
name—"foo"
Returns: "\xFF/globals/foo"
SpecialKey
static Slice SpecialKey(Slice name)
Returns the corresponding key for a special key attribute
name— Name of the special key, for example:`/foo/bar`
Returns: Name prefixed by \xFF\xFF, for example: `\xFF\xFF/foo/bar`
SpecialKey(Slice.FromString("/foo/bar")) => \xFF\xFF/foo/bar
static Slice SpecialKey(string name)
Returns the corresponding key for a special key attribute
name— Name of the special key, for example:"/foo/bar"
Returns: Name prefixed by \xFF\xFF, for example: "\xFF\xFF/foo/bar"
SpecialKey("/foo/bar") => \xFF\xFF/foo/bar
TryParseAddress
static bool TryParseAddress(ReadOnlySpan<char> address, out IPAddress host, out int port, out bool tls)
WorkersKey
static Slice WorkersKey(string id, string name)
Return the corresponding key for a global attribute
id—"ABC123"name—"foo"
Returns: "\xFF/workers/ABC123/foo"
Fields
BackupDataFormat
static readonly Slice BackupDataFormat
"\xFF/backupDataFormat"
ConfigPrefix
static readonly Slice ConfigPrefix
\xFF/conf/...
Coordinators
static readonly Slice Coordinators
\xFF/coordinators
GlobalsPrefix
static readonly Slice GlobalsPrefix
\xFF/globals/...
InitId
static readonly Slice InitId
`\xFF/init_id`
KeyServers
static readonly Slice KeyServers
`\xFF/keyServer/(key_boundary)` => (..., node_id, ...)
MaxValue
static readonly Slice MaxValue
"\xFF\xFF"
MetadataVersionKey
static readonly Slice MetadataVersionKey
"\xFF/metadataVersion"
MinValue
static readonly Slice MinValue
"\xFF\x00"
ServerKeys
static readonly Slice ServerKeys
`\xFF/serverKeys/(node_id)/(key_boundary)` => ('' | '1')
ServerList
static readonly Slice ServerList
`\xFF/serverList/(node_id)` => (..., node_id, machine_id, datacenter_id, ...)
SpecialKeyPrefix
static readonly Slice SpecialKeyPrefix
"\xFF\xFF"
StatusJson
static readonly Slice StatusJson
`\xFF\xFF/status/json` =>
TransactionConflictingKeysPrefix
static readonly Slice TransactionConflictingKeysPrefix
`\xFF\xFF/transaction/conflicting_keys/`... => ('0' | '1')
WorkersPrefix
static readonly Slice WorkersPrefix
`\xFF/workers/(ip:port)/...` => datacenter + machine + mclass