Creating an SstFileWriter
Constructor
const EnvOptions&
Environment options for file operations.
const Options&
Database options including comparator and table options.
ColumnFamilyHandle*
Target column family. Pass nullptr if unknown.
bool
If true, hints to OS that file pages are not needed after writing.
Env::IOPriority
I/O priority for rate limiting.
Opening a File
Open
const std::string&
Path where the SST file will be created.
Temperature
Temperature hint for storage placement (kHot, kWarm, kCold).
Status
Returns OK on success.
Adding Data
Put
const Slice&
Key to add. Must be after any previously added key according to the comparator.
const Slice&
Value to associate with the key.
Status
Returns OK on success, InvalidArgument if key order is violated.
Put with Timestamp
const Slice&
User-defined timestamp. Size must match comparator expectations.
PutEntity
const WideColumns&
Wide-column entity data.
Merge
Delete
Delete with Timestamp
DeleteRange
const Slice&
Start of the range (inclusive).
const Slice&
End of the range (exclusive).
Finalizing the File
Finish
ExternalSstFileInfo*
Optional output parameter populated with information about the created file.
Status
Returns OK on success.
FileSize
uint64_t
Current size of the SST file in bytes.
File Information
ExternalSstFileInfo
std::string
Path to the created SST file.
std::string
Smallest user key in the file.
std::string
Largest user key in the file.
SequenceNumber
Sequence number of all keys in the file (always 0 for SstFileWriter).
uint64_t
File size in bytes.
uint64_t
Number of entries in the file.
Example: Basic Usage
Example: Bulk Loading with Ingestion
Example: Range Deletions
Key Ordering Requirements
Sorted Keys Required
Keys must be added in sorted order according to the comparator:Range Deletions Are Order-Independent
Range deletion tombstones can be added in any order:Verification
CreatedBySstFileWriter
const TableProperties&
Table properties to check.
bool
Returns true if the file was created by SstFileWriter.