Class Checkpoint
- Namespace
- RocksDbNet
- Assembly
- RocksDb.Net.dll
Creates on-disk checkpoints (hard-link-based snapshots) of a RocksDb database.
Maps to rocksdb_checkpoint_t.
public sealed class Checkpoint : RocksDbHandle, IDisposable
- Inheritance
-
Checkpoint
- Implements
- Inherited Members
Methods
Create(RocksDb)
Creates a Checkpoint object for the given database.
public static Checkpoint Create(RocksDb db)
Parameters
dbRocksDb
Returns
CreateCheckpoint(string, ulong)
Creates a new database checkpoint at checkpointDir.
If logSizeForFlush is 0, all memtables are flushed.
public void CreateCheckpoint(string checkpointDir, ulong logSizeForFlush = 0)
Parameters
DisposeHandle()
Releases the native handle. Called during disposal.
protected override void DisposeHandle()
Remarks
Protected rather than public: it destroys the native object without marking this instance disposed or clearing the handle, so calling it from outside and then disposing normally would free the same pointer twice. It was the most Dispose-looking member on the type. Callers want Dispose().
ExportColumnFamily(ColumnFamilyHandle, string)
Writes one column family's live files into exportDir
and returns the metadata needed to import them elsewhere.
public ExportImportFilesMetadata ExportColumnFamily(ColumnFamilyHandle cf, string exportDir)
Parameters
cfColumnFamilyHandleThe column family to export.
exportDirstringDirectory to write into. It must not already exist: RocksDb creates it and fails with "Specified export_dir exists" otherwise, even if the directory is empty. Pass a path under a directory you control rather than one you have already created.
Returns
Remarks
Unlike CreateCheckpoint(string, ulong), which copies a whole database into something you open separately, this exports a single column family so it can be imported into a database that is already running. That is the way to copy a column family between databases, rename one, or restore just one part of a database.
The export holds no write-ahead log and no history, only the current contents. Dispose the returned metadata when finished with it.