Skip to main content

RefWriter

Trait RefWriter 

Source
pub trait RefWriter: Send + Sync {
    // Required methods
    fn update_ref(
        &self,
        refname: &str,
        target: &[u8],
        message: &str,
    ) -> Result<(), StorageError>;
    fn delete_ref(&self, refname: &str) -> Result<(), StorageError>;
}
Expand description

Creates, updates, and deletes abstract references.

In a Git-backed implementation, this corresponds to creating or updating Git refs. The domain provides opaque target bytes and a human-readable message for the reflog.

Usage:

use auths_core::ports::storage::RefWriter;

fn advance_tip(writer: &dyn RefWriter, refname: &str, new_oid: &[u8]) {
    writer.update_ref(refname, new_oid, "append attestation").unwrap();
}

Required Methods§

Source

fn update_ref( &self, refname: &str, target: &[u8], message: &str, ) -> Result<(), StorageError>

Sets a reference to point at the given target bytes.

Args:

  • refname: The reference name to create or update.
  • target: The opaque target bytes (e.g., a commit OID).
  • message: A human-readable description of the update for logging.

Usage:

writer.update_ref("refs/auths/registry", &new_oid, "rotation event")?;
Source

fn delete_ref(&self, refname: &str) -> Result<(), StorageError>

Deletes the named reference.

Args:

  • refname: The reference name to delete.

Usage:

writer.delete_ref("refs/auths/devices/nodes/old-device/signatures")?;

Implementors§