Trait iroh_blobs::util::TagCounter

source ·
pub trait TagCounter: TagDrop + Sized {
    // Required method
    fn on_create(&self, inner: &HashAndFormat);

    // Provided methods
    fn as_weak(self: &Arc<Self>) -> Weak<dyn TagDrop> { ... }
    fn temp_tag(self: &Arc<Self>, inner: HashAndFormat) -> TempTag { ... }
}
Expand description

A trait for things that can track liveness of blobs and collections.

This trait works together with TempTag to keep track of the liveness of a blob or collection.

It is important to include the format in the liveness tracking, since protecting a collection means protecting the blob and all its children, whereas protecting a raw blob only protects the blob itself.

Required Methods§

source

fn on_create(&self, inner: &HashAndFormat)

Called on creation of a temp tag

Provided Methods§

source

fn as_weak(self: &Arc<Self>) -> Weak<dyn TagDrop>

Get this as a weak reference for use in temp tags

source

fn temp_tag(self: &Arc<Self>, inner: HashAndFormat) -> TempTag

Create a new temp tag for the given hash and format

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl TagCounter for RwLock<TempCounterMap>

source§

fn on_create(&self, content: &HashAndFormat)

Implementors§