Table of Contents

Class LiveFileMetadata

Namespace
RocksDbNet
Assembly
RocksDb.Net.dll

Metadata for a single live SST file in the database.

public sealed record LiveFileMetadata : IEquatable<LiveFileMetadata>
Inheritance
LiveFileMetadata
Implements
Inherited Members

Remarks

A snapshot, read in full before it is handed over, so it needs no disposal and can be kept and passed around freely. It used to read through its parent on every property access, which meant an instance was only valid while that parent was alive. See the ownership guide for why this library copies rather than lending.

Constructors

LiveFileMetadata(string, string, int, ulong, byte[]?, byte[]?, ulong, ulong, ulong, ulong)

Metadata for a single live SST file in the database.

public LiveFileMetadata(string Name, string Directory, int Level, ulong Size, byte[]? SmallestKey, byte[]? LargestKey, ulong SmallestSequenceNumber, ulong LargestSequenceNumber, ulong Entries, ulong Deletions)

Parameters

Name string

The SST file name, without a directory part.

Directory string

The directory holding the file, which is not always the database directory when several paths are configured.

Level int

The LSM level the file sits at. Zero is the newest level, written directly by flushes, and higher numbers hold older, larger, compacted data.

Size ulong

The file size in bytes.

SmallestKey byte[]

The lowest key in the file, or null if RocksDb reported none.

LargestKey byte[]

The highest key in the file, or null if RocksDb reported none.

SmallestSequenceNumber ulong

The lowest sequence number in the file. With LargestSequenceNumber this bounds when the file's writes happened relative to the rest of the database.

LargestSequenceNumber ulong

The highest sequence number in the file.

Entries ulong

How many entries the file holds, counting tombstones as entries. Subtract Deletions for a rough live-key count.

Deletions ulong

How many of the file's entries are tombstones. A file that is mostly tombstones is a candidate for compaction, since every read across its key range has to walk them.

Remarks

A snapshot, read in full before it is handed over, so it needs no disposal and can be kept and passed around freely. It used to read through its parent on every property access, which meant an instance was only valid while that parent was alive. See the ownership guide for why this library copies rather than lending.

Properties

Deletions

How many of the file's entries are tombstones. A file that is mostly tombstones is a candidate for compaction, since every read across its key range has to walk them.

public ulong Deletions { get; init; }

Property Value

ulong

Directory

The directory holding the file, which is not always the database directory when several paths are configured.

public string Directory { get; init; }

Property Value

string

Entries

How many entries the file holds, counting tombstones as entries. Subtract Deletions for a rough live-key count.

public ulong Entries { get; init; }

Property Value

ulong

LargestKey

The highest key in the file, or null if RocksDb reported none.

public byte[]? LargestKey { get; init; }

Property Value

byte[]

LargestSequenceNumber

The highest sequence number in the file.

public ulong LargestSequenceNumber { get; init; }

Property Value

ulong

Level

The LSM level the file sits at. Zero is the newest level, written directly by flushes, and higher numbers hold older, larger, compacted data.

public int Level { get; init; }

Property Value

int

Name

The SST file name, without a directory part.

public string Name { get; init; }

Property Value

string

Size

The file size in bytes.

public ulong Size { get; init; }

Property Value

ulong

SmallestKey

The lowest key in the file, or null if RocksDb reported none.

public byte[]? SmallestKey { get; init; }

Property Value

byte[]

SmallestSequenceNumber

The lowest sequence number in the file. With LargestSequenceNumber this bounds when the file's writes happened relative to the rest of the database.

public ulong SmallestSequenceNumber { get; init; }

Property Value

ulong