include "sst.fbs"; table Uuid { high: uint64; low: uint64; } // Manifest to persist state of DB. table ManifestV1 { // Id of manifest. Manifest file name will be derived from this id. manifest_id: ulong; // Flag to indicate whether initialization has finished. When creating the initial manifest for // a root db (one that is not a clone), this flag will be set to true. When creating the initial // manifest for a clone db, this flag will be set to false and then updated to true once clone // initialization has completed. initialized: bool; // The current writer's epoch. writer_epoch: ulong; // The current compactor's epoch. compactor_epoch: ulong; // The most recent SST in the WAL that's been compacted. wal_id_last_compacted: ulong; // The most recent SST in the WAL at the time manifest was updated. wal_id_last_seen: ulong; // The last compacted l0 l0_last_compacted: CompactedSstId; // A list of the L0 SSTs that are valid to read in the `compacted` folder. l0: [CompactedSsTable] (required); // A list of the sorted runs that are valid to read in the `compacted` folder. compacted: [SortedRun] (required); // The last clock tick last_clock_tick: long; // A list of checkpoints that are currently open. checkpoints: [Checkpoint] (required); } table SortedRun { id: uint32; ssts: [CompactedSsTable] (required); } table WriterCheckpoint { epoch: uint64; } union CheckpointMetadata { WriterCheckpoint } // Checkpoint reference to be included in manifest to record active checkpoints. table Checkpoint { // Id that must be unique across all open checkpoints. id: Uuid (required); // The manifest ID that this checkpoint is using as its `DbState`. manifest_id: ulong; // The UTC unix timestamp seconds that a checkpoint expires at. Clients may update this value. // If `checkpoint_expire_time_s` is older than now(), the checkpoint is considered expired. // If `checkpoint_expire_time_s` is 0, the checkpoint will never expire. checkpoint_expire_time_s: uint; // The unix timestamp seconds that the checkpoint was created checkpoint_create_time_s: uint; // Optional metadata associated with the checkpoint. For example, the writer can use this to // clean up checkpoints from older writers. metadata: CheckpointMetadata; }