Skip to main content

Writer

Struct Writer 

Source
pub struct Writer<T> { /* private fields */ }

Implementations§

Source§

impl<T: SegmentReadWrite> Writer<T>

Source

pub fn new_at( ctx: T, buf_size: usize, segid: SegmentId, hyper_file_config: &HyperFileMetaConfig, ) -> Self

A writer aimed at exactly the object segid names.

Source

pub fn set_base(&mut self, fingerprint: u64)

Record the inode this checkpoint is built on; see SegmentHeader::s_base.

Source

pub fn segid(&self) -> SegmentId

The object this writer produces.

Source

pub fn mark_partial(&mut self)

Mark what this writer produces as one piece of an unfinished checkpoint.

Source

pub fn mark_cleaner(&mut self)

Mark what this writer produces as a compactor’s.

Source

pub fn new( ctx: T, buf_size: usize, segid: SegmentId, hyper_file_config: &HyperFileMetaConfig, ) -> Self

Source

pub fn blocks_that_fit(cap: usize, fixed: usize, block_size: usize) -> usize

How many data blocks of block_size one object of at most cap bytes can hold after fixed bytes of meta blocks, counting the summary those blocks need. Zero when not even the summary and the meta blocks fit.

Source

pub fn calc_ss_aligned_bytes(ndatablk: usize) -> usize

Source

pub fn realize_ss(&mut self, checksum: u32, inode: &InodeRaw)

Source

pub fn append(&mut self, buf: &[u8]) -> Result<()>

Source

pub fn append_data_block(&mut self, block: &DataBlock) -> Result<()>

Append one cached data block to the segment.

Non-WAL: pushes a zero-copy Bytes view over the block’s internal Arc<AllocDataBlock> (no memcpy of the 4 KiB payload). The cache continues to hold the block; the segment body holds an extra Arc clone via the Bytes, so the buffer lives as long as the upload needs it.

WAL: falls back to the buffer-based append path because the WAL feature requires the segment body to live as one contiguous Vec<u8> for in-memory replay.

Source

pub fn append_lazy(&mut self, src: Arc<dyn BlockSource>, off: u64, len: usize)

Append len bytes to be read from src at off when the part holding them is uploaded (see crate::block_source). Non-WAL only: the WAL path keeps the whole segment in one buffer, which is the memory a reference avoids.

Source

pub async fn done(self) -> Result<()>

Source§

impl<T> Writer<T>

Source

pub fn inc_metablk(&mut self)

Source

pub fn inc_datablk(&mut self, blkidx: &BlockIndex, blkptr: &BlockPtr)

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for Writer<T>

§

impl<T> !UnwindSafe for Writer<T>

§

impl<T> Freeze for Writer<T>
where T: Freeze,

§

impl<T> Send for Writer<T>
where T: Send,

§

impl<T> Sync for Writer<T>
where T: Sync,

§

impl<T> Unpin for Writer<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Writer<T>
where T: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scope for T

Source§

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.
Source§

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.
Source§

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> Value for T
where T: Send + Sync + 'static,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more