Struct ObjectManager

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

ObjectManager is a global loading cache for object stores and other special objects.

Implementations§

Source§

impl ObjectManager

Source

pub fn new( on_new_store: Option<Box<dyn Fn(&ObjectStore) + Send + Sync>>, ) -> ObjectManager

Source

pub fn required_reservation(&self) -> u64

Source

pub fn root_parent_store_object_id(&self) -> u64

Source

pub fn root_parent_store(&self) -> Arc<ObjectStore>

Source

pub fn set_root_parent_store(&self, store: Arc<ObjectStore>)

Source

pub fn root_store_object_id(&self) -> u64

Source

pub fn root_store(&self) -> Arc<ObjectStore>

Source

pub fn set_root_store(&self, store: Arc<ObjectStore>)

Source

pub fn is_system_store(&self, store_id: u64) -> bool

Source

pub fn store(&self, store_object_id: u64) -> Option<Arc<ObjectStore>>

Returns the store which might or might not be locked.

Source

pub async fn on_replay_complete(&self) -> Result<(), Error>

This is not thread-safe: it assumes that a store won’t be forgotten whilst the loop is running. This is to be used after replaying the journal.

Source

pub fn volume_directory(&self) -> &Directory<ObjectStore>

Source

pub fn set_volume_directory(&self, volume_directory: Directory<ObjectStore>)

Source

pub fn add_store(&self, store: Arc<ObjectStore>)

Source

pub fn forget_store(&self, store_object_id: u64)

Source

pub fn set_allocator(&self, allocator: Arc<Allocator>)

Source

pub fn allocator(&self) -> Arc<Allocator>

Source

pub fn apply_mutation( &self, object_id: u64, mutation: Mutation, context: &ApplyContext<'_, '_>, associated_object: AssocObj<'_>, ) -> Result<(), Error>

Applies mutation to object with context.

Source

pub async fn replay_mutations( &self, mutations: Vec<(u64, Mutation)>, journal_offsets: &HashMap<u64, u64>, context: &ApplyContext<'_, '_>, end_offset: u64, ) -> Result<(), Error>

Replays mutations for a single transaction. journal_offsets contains the per-object starting offsets; if the current transaction offset precedes an offset, the mutations for that object are ignored. context contains the location in the journal file for this transaction and end_offset is the ending journal offset for this transaction.

Source

pub fn apply_transaction( &self, transaction: &mut Transaction<'_>, checkpoint: &JournalCheckpoint, ) -> Result<Option<Mutation>, Error>

Called by the journaling system to apply a transaction. checkpoint indicates the location in the journal file for this transaction. Returns an optional mutation to be written to be included with the transaction.

Source

pub fn did_commit_transaction( &self, transaction: &mut Transaction<'_>, _checkpoint: &JournalCheckpoint, end_offset: u64, )

Called by the journaling system after a transaction has been written providing the end offset for the transaction so that we can adjust borrowed metadata space accordingly.

Source

pub fn drop_transaction(&self, transaction: &mut Transaction<'_>)

Drops a transaction. This is called automatically when a transaction is dropped. If the transaction has been committed, it should contain no mutations and so nothing will get rolled back. For each mutation, drop_mutation is called to allow for roll back (e.g. the allocator will unreserve allocations).

Source

pub fn journal_file_offsets( &self, ) -> (HashMap<u64, u64>, Option<JournalCheckpoint>)

Returns the journal file offsets that each object depends on and the checkpoint for the minimum offset.

Source

pub fn journal_checkpoint(&self, object_id: u64) -> Option<JournalCheckpoint>

Returns the checkpoint into the journal that the object depends on, or None if the object has no journaled updates.

Source

pub fn needs_flush(&self, object_id: u64) -> bool

Returns true if the object identified by object_id is known to have updates recorded in the journal that the object depends upon.

Source

pub async fn flush(&self) -> Result<Version, Error>

Flushes all known objects. This will then allow the journal space to be freed.

Also returns the earliest known version of a struct on the filesystem.

Source

pub fn init_metadata_reservation(&self) -> Result<(), Error>

Source

pub fn metadata_reservation(&self) -> &Reservation

Source

pub fn update_reservation(&self, object_id: u64, amount: u64)

Source

pub fn reservation(&self, object_id: u64) -> Option<u64>

Source

pub fn set_reserved_space(&self, amount: u64)

Source

pub fn last_end_offset(&self) -> u64

Source

pub fn set_last_end_offset(&self, v: u64)

Source

pub fn borrowed_metadata_space(&self) -> u64

Source

pub fn set_borrowed_metadata_space(&self, v: u64)

Source

pub fn write_mutation( &self, object_id: u64, mutation: &Mutation, writer: Writer<'_>, )

Source

pub fn unlocked_stores(&self) -> Vec<Arc<ObjectStore>>

Source

pub fn track_statistics(self: &Arc<Self>, parent: &Node, name: &str)

Creates a lazy inspect node named str under parent which will yield statistics for the object manager when queried.

Source

pub fn needs_borrow_for_journal(&self, checkpoint: u64) -> bool

Normally, we make new transactions pay for overheads incurred by the journal, such as checksums and padding, but if the journal has discarded a significant amount after a replay, we run the risk of there not being enough reserved. To handle this, if the amount is significant, we force the journal to borrow the space (using a journal created transaction).

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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V