//! RocksDB storage layer for Chainfire distributed KVS
//!
//! This crate provides:
//! - RocksDB-backed persistent storage
//! - Key-Value operations (Put, Get, Delete, Scan)
//! - Lease management for TTL-based key expiration
//! - Log storage for Raft
//! - State machine for Raft
//! - Snapshot management

pub mod kv_store;
pub mod lease_store;
pub mod log_storage;
pub mod snapshot;
pub mod state_machine;
pub mod store;

pub use kv_store::KvStore;
pub use lease_store::{LeaseExpirationWorker, LeaseStore};
pub use log_storage::{LogStorage, LogEntry, EntryPayload, LogId, Vote, LogState};
pub use snapshot::{Snapshot, SnapshotBuilder, SnapshotMeta};
pub use state_machine::StateMachine;
pub use store::RocksStore;

/// Column family names for RocksDB
pub mod cf {
    /// Raft log entries
    pub const LOGS: &str = "raft_logs";
    /// Raft metadata (vote, term, etc.)
    pub const META: &str = "raft_meta";
    /// Key-value data
    pub const KV: &str = "key_value";
    /// Snapshot metadata
    pub const SNAPSHOT: &str = "snapshot";
    /// Lease data
    pub const LEASES: &str = "leases";
}

/// Metadata keys
pub mod meta_keys {
    /// Current term and vote
    pub const VOTE: &[u8] = b"vote";
    /// Last applied log ID
    pub const LAST_APPLIED: &[u8] = b"last_applied";
    /// Current membership
    pub const MEMBERSHIP: &[u8] = b"membership";
    /// Current revision
    pub const REVISION: &[u8] = b"revision";
    /// Last snapshot ID
    pub const LAST_SNAPSHOT: &[u8] = b"last_snapshot";
}
