FdbSuccessorKey<TKey>

Namespace: FoundationDB.Client · struct

Implements: IFdbKey, ISpanEncodable, ISpanFormattable, IFormattable, IEquatable<FdbRawKey>, IComparable<FdbRawKey>, IEquatable<Slice>, IComparable<Slice>, IEquatable<IFdbKey>, IComparable, IEquatable<ReadOnlySpan<byte>>, IComparable<ReadOnlySpan<byte>>, IEquatable<FdbSuccessorKey<TKey>>, IComparable<FdbSuccessorKey<TKey>>

Key that appends the 0x00 byte to another key

Remarks

By definition, there can not be any other in between this key and its parent.

It is frequently used to convert an inclusive bound into an exclusive bound.

It is also possible to have the same behavior by switching from FirstGreaterThan to FirstGreaterOrEqual, or by adding an offset of 1 to a more complex selector.

Constructors

FdbSuccessorKey<TKey>

FdbSuccessorKey<TKey>(in TKey parent)

Methods

CompareTo

int CompareTo(object obj)

int CompareTo(FdbSuccessorKey<TKey> other)

int CompareTo(FdbRawKey other)

int CompareTo(Slice other)

int CompareTo(ReadOnlySpan<byte> other)

Contains

bool Contains(ReadOnlySpan<byte> key)

Tests if this key is a prefix of the given key

  • key — Key being tested

Returns: true if key starts with the same bytes as the current key; otherwise, false

The key foobar is contained inside foo because it starts with foo, but bar is NOT contained inside foo because it does not have the same prefix.

Any key contains "itself", so foo is contained inside foo

bool Contains<TOtherKey>(in TOtherKey key)

Tests if this key is a prefix of the given key

  • key — Key being tested

Returns: true if key starts with the same bytes as the current key; otherwise, false

The key foobar is contained inside foo because it starts with foo, but bar is NOT contained inside foo because it does not have the same prefix.

Any key contains "itself", so foo is contained inside foo

Equals

bool Equals(object other)

bool Equals(IFdbKey other)

bool Equals(FdbSuccessorKey<TKey> other)

bool Equals(FdbRawKey other)

bool Equals(Slice other)

bool Equals(ReadOnlySpan<byte> other)

FastCompareTo

int FastCompareTo<TOtherKey>(in TOtherKey other)

FastEqualTo

bool FastEqualTo<TOtherKey>(in TOtherKey other)

GetHashCode

int GetHashCode()

ToString

string ToString()

string ToString(string format, IFormatProvider formatProvider = null)

TryEncode

bool TryEncode(Span<byte> destination, out int bytesWritten)

Encodes this instance into its equivalent binary representation in the database

  • destination — Destination buffer
  • bytesWritten — Number of bytes written to the buffer

Returns: true if the operation was successful and the buffer was large enough, or false if it was too small

TryFormat

bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider)

TryGetSizeHint

bool TryGetSizeHint(out int sizeHint)

Returns a quick estimate of the initial buffer size that would be large enough to encode this instance, in a single call to TryEncode

  • sizeHint — Receives an initial capacity that will satisfy almost all values. There is no guarantees that the size will be exact, and the estimate may be smaller or larger than the actual encoded size.

Returns: true if a size could be quickly computed; otherwise, false

TryGetSpan

bool TryGetSpan(out ReadOnlySpan<byte> span)

Returns the already encoded binary representation of the instance, if already available.

  • span — Points to the in-memory binary representation of the encoded key

Returns: true if the key has already been encoded, or it its in-memory layout is the same; otherwise, false

This is only intended to support pass-through or already encoded keys (via Slice), or when the binary representation has been cached to allow multiple uses.

Fields

Parent

readonly TKey Parent