// Copyright 2026 TiKV Project Authors. Licensed under Apache-2.0.

//! A small, safe implementation of the RocksDB block-based SST format.
//!
//! This crate intentionally implements a file format, not a database. Its
//! compatibility target is external SST files emitted by TiKV's legacy Backup
//! gRPC service. It has no RocksDB, Titan, C, or C++ dependency.

mod block;
mod checksum;
mod coding;
mod compression;
mod table;

pub use checksum::ChecksumType;
pub use compression::CompressionType;
pub use table::{
    Entry, Options, Reader, TableIterator, TableStats, Writer, WriterOutput, collect_sst,
};
use thiserror::Error;

/// An error encountered while reading or writing a legacy SST file.
#[derive(Debug, Error)]
pub enum Error {
    #[error("corrupt legacy SST: {0}")]
    Corruption(String),
    #[error("unsupported legacy SST feature: {0}")]
    Unsupported(String),
    #[error("legacy SST I/O error: {0}")]
    Io(#[from] std::io::Error),
}

/// Result type used by this crate.
pub type Result<T> = std::result::Result<T, Error>;
