Skip to main content

ReftableStack

Struct ReftableStack 

Source
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

Source

pub fn open(git_dir: &Path) -> Result<Self>

Open an existing reftable stack.

Source

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.

Source

pub fn lookup_ref(&self, name: &str) -> Result<Option<RefRecord>>

Look up a single ref across all tables (most recent wins).

Source

pub fn read_logs_for_ref(&self, refname: &str) -> Result<Vec<LogRecord>>

Read merged log records for a specific ref.

Source

pub fn read_all_logs(&self) -> Result<Vec<LogRecord>>

Read all log records across all tables.

Source

pub fn max_update_index(&self) -> Result<u64>

Get the current max update index across all tables.

Source

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.

Source

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.

Source

pub fn compact(&mut self) -> Result<()>

Compact all tables into a single table.

Source

pub fn table_names(&self) -> &[String]

Return the list of table filenames in this stack.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.