pub struct Graveyard { /* private fields */ }
Expand description
A graveyard exists as a place to park objects that should be deleted when they are no longer in use. How objects enter and leave the graveyard is up to the caller to decide. The intention is that at mount time, any objects in the graveyard will get removed. Each object store has a directory like object that contains a list of the objects within that store that are part of the graveyard. A single instance of this Graveyard struct manages all stores.
Implementations§
Source§impl Graveyard
impl Graveyard
Sourcepub fn new(object_manager: Arc<ObjectManager>) -> Arc<Self>
pub fn new(object_manager: Arc<ObjectManager>) -> Arc<Self>
Creates a new instance of the graveyard manager.
Sourcepub fn create(transaction: &mut Transaction<'_>, store: &ObjectStore) -> u64
pub fn create(transaction: &mut Transaction<'_>, store: &ObjectStore) -> u64
Creates a graveyard object in store
. Returns the object ID for the graveyard object.
Sourcepub fn reap_async(self: Arc<Self>)
pub fn reap_async(self: Arc<Self>)
Starts an asynchronous task to reap the graveyard for all entries older than |journal_offset| (exclusive). If a task is already started, this has no effect, even if that task was targeting an older |journal_offset|.
Sourcepub async fn wait_for_reap(&self)
pub async fn wait_for_reap(&self)
Returns a future which completes when the ongoing reap task (if it exists) completes.
Sourcepub async fn initial_reap(
self: &Arc<Self>,
store: &ObjectStore,
) -> Result<usize, Error>
pub async fn initial_reap( self: &Arc<Self>, store: &ObjectStore, ) -> Result<usize, Error>
Performs the initial mount-time reap for the given store. This will queue all items in the graveyard. Concurrently adding more entries to the graveyard will lead to undefined behaviour: the entries might or might not be immediately tombstoned, so callers should wait for this to return before changing to a state where more entries can be added. Once this has returned, entries will be tombstoned in the background.
Sourcepub fn queue_tombstone_object(&self, store_id: u64, object_id: u64)
pub fn queue_tombstone_object(&self, store_id: u64, object_id: u64)
Queues an object for tombstoning.
Sourcepub fn queue_tombstone_attribute(
&self,
store_id: u64,
object_id: u64,
attribute_id: u64,
)
pub fn queue_tombstone_attribute( &self, store_id: u64, object_id: u64, attribute_id: u64, )
Queues an object’s attribute for tombstoning.
Sourcepub async fn tombstone_object(
&self,
store_id: u64,
object_id: u64,
) -> Result<(), Error>
pub async fn tombstone_object( &self, store_id: u64, object_id: u64, ) -> Result<(), Error>
Immediately tombstones (discards) an object in the graveyard. NB: Code should generally use |queue_tombstone| instead.
Sourcepub async fn tombstone_attribute(
&self,
store_id: u64,
object_id: u64,
attribute_id: u64,
) -> Result<(), Error>
pub async fn tombstone_attribute( &self, store_id: u64, object_id: u64, attribute_id: u64, ) -> Result<(), Error>
Immediately tombstones (discards) and attribute in the graveyard. NB: Code should generally use |queue_tombstone| instead.
Sourcepub async fn iter<'a, 'b>(
graveyard_object_id: u64,
merger: &'a mut Merger<'b, ObjectKey, ObjectValue>,
) -> Result<GraveyardIterator<'a, 'b>, Error>
pub async fn iter<'a, 'b>( graveyard_object_id: u64, merger: &'a mut Merger<'b, ObjectKey, ObjectValue>, ) -> Result<GraveyardIterator<'a, 'b>, Error>
Returns an iterator that will return graveyard entries skipping deleted ones. Example usage:
let layer_set = graveyard.store().tree().layer_set(); let mut merger = layer_set.merger(); let mut iter = graveyard.iter(&mut merger).await?;
Auto Trait Implementations§
impl !Freeze for Graveyard
impl !RefUnwindSafe for Graveyard
impl Send for Graveyard
impl Sync for Graveyard
impl Unpin for Graveyard
impl !UnwindSafe for Graveyard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more