pub struct ReftableStack { /* private fields */ }Expand description
Manages the $GIT_DIR/reftable/ directory and tables.list stack.
The stack provides a merged view of all tables, with later tables taking precedence over earlier ones.
Implementations§
Source§impl ReftableStack
impl ReftableStack
Sourcepub fn read_refs(&self) -> Result<Vec<RefRecord>>
pub fn read_refs(&self) -> Result<Vec<RefRecord>>
Read a merged view of all ref records.
Later tables override earlier ones. Deletion records cause the ref to be omitted from the result.
Sourcepub fn lookup_ref(&self, name: &str) -> Result<Option<RefRecord>>
pub fn lookup_ref(&self, name: &str) -> Result<Option<RefRecord>>
Look up a single ref across all tables (most recent wins).
Sourcepub fn read_logs_for_ref(&self, refname: &str) -> Result<Vec<LogRecord>>
pub fn read_logs_for_ref(&self, refname: &str) -> Result<Vec<LogRecord>>
Read merged log records for a specific ref.
Sourcepub fn read_all_logs(&self) -> Result<Vec<LogRecord>>
pub fn read_all_logs(&self) -> Result<Vec<LogRecord>>
Read all log records across all tables.
Sourcepub fn max_update_index(&self) -> Result<u64>
pub fn max_update_index(&self) -> Result<u64>
Get the current max update index across all tables.
Sourcepub fn add_table(&mut self, data: &[u8], update_index: u64) -> Result<String>
pub fn add_table(&mut self, data: &[u8], update_index: u64) -> Result<String>
Add a new reftable to the stack.
Writes the table bytes to a new file, then atomically updates
tables.list.
Sourcepub fn write_ref(
&mut self,
refname: &str,
value: RefValue,
log: Option<LogRecord>,
opts: &WriteOptions,
) -> Result<()>
pub fn write_ref( &mut self, refname: &str, value: RefValue, log: Option<LogRecord>, opts: &WriteOptions, ) -> Result<()>
Write a ref update (add/update/delete) as a new reftable.
This is the main entry point for updating refs in a reftable repo.
Sourcepub fn table_names(&self) -> &[String]
pub fn table_names(&self) -> &[String]
Return the list of table filenames in this stack.