Skip to main content

MemoryRefStore

Struct MemoryRefStore 

Source
pub struct MemoryRefStore { /* private fields */ }
Expand description

Fully in-memory ref database with transactional updates.

Built only on the public super::backend helpers, so it doubles as a reference for custom backends.

Implementations§

Source§

impl MemoryRefStore

Source

pub fn new() -> Self

Create an empty store.

Source

pub fn set_ref( &self, name: impl Into<String>, value: RawRef, ) -> Result<(), RefStoreError>

Seed a ref without going through a transaction (tests and setup).

§Errors

Returns RefStoreError::LockHeld when a transaction is prepared.

Trait Implementations§

Source§

impl Debug for MemoryRefStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryRefStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl RefStore for MemoryRefStore

Source§

fn format(&self) -> RefStorageFormat

Which on-disk or logical format this store uses. Read more
Source§

fn read_raw(&self, name: &str) -> Result<Option<RawRef>>

Read the stored value for name without resolving symbolic targets. Read more
Source§

fn for_each_ref( &self, prefix: &str, f: &mut dyn FnMut(&RefEntry) -> ControlFlow<()>, ) -> Result<()>

Invoke f for each ref whose name starts with prefix, in sorted name order. Read more
Source§

fn prepare( &self, txn: RefTransaction, ) -> Result<Box<dyn PreparedRefTransaction + Send + '_>, RefStoreError>

Validate txn, take locks, and return a committable batch. Read more
Source§

fn reflog_exists(&self, name: &str) -> Result<bool>

Whether a reflog is present for name.
Source§

fn for_each_reflog_entry( &self, name: &str, reverse: bool, f: &mut dyn FnMut(&ReflogEntry) -> ControlFlow<()>, ) -> Result<()>

Iterate reflog entries for name (oldest first unless reverse). Read more
Source§

fn create_reflog(&self, name: &str) -> Result<()>

Create an empty reflog file/record for name.
Source§

fn delete_reflog(&self, name: &str) -> Result<()>

Remove the reflog for name.
Source§

fn replace_reflog(&self, name: &str, entries: Vec<ReflogEntry>) -> Result<()>

Replace the entire reflog (used by expire/delete-entries).
Source§

fn for_each_reflog_ref( &self, f: &mut dyn FnMut(&str) -> ControlFlow<()>, ) -> Result<()>

Invoke f for each ref name that has a reflog, in sorted order. Read more
Source§

fn resolve(&self, name: &str) -> Result<ObjectId>

Resolve name to an object id, following symbolic refs. Read more
Source§

fn as_files(&self) -> Option<&FilesRefStore>

The files backend behind this store, when it is one. Read more

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.