[][src]Struct librapidarchive::spanning::DataZone

pub struct DataZone<P> {
    pub ident: Option<P>,
    pub length: u64,
    pub committed_length: u64,
    pub uncommitted_length: u64,
}

Represents data which has been committed to a write buffer and may fail to be written to the device.

Fields

ident: Option<P>length: u64

The total count of bytes written within this zone. Must equal the sum of committed_length and uncommitted_length

committed_length: u64

The number of those bytes which have been committed to the device.

uncommitted_length: u64

The remaining bytes not committed to the device.

Methods

impl<P> DataZone<P>[src]

pub fn new(ident: P) -> DataZone<P>[src]

pub fn for_resumption(ident: P, committed: u64) -> DataZone<P>[src]

pub fn slack_zone() -> DataZone<P>[src]

Create a zone that represents data written outside of a data zone.

Slack zones are data that was not intended to be recovered in the event of write failure and exist only to ensure counts between active data zones are correct.

pub fn write_through(&mut self, length: u64)[src]

Mark a number of bytes which were successfully written through without buffering.

pub fn write_buffered(&mut self, length: u64)[src]

Mark a number of bytes which were buffered but have not yet been committed to the target device and may still fail.

pub fn write_committed(&mut self, length: u64) -> Option<u64>[src]

Mark a number of buffered bytes which have been copied from the writer's internal buffer and committed to the destination device.

Returns

If uncommitted data still remains within this zone, returns None.

Otherwise, if the zone has been completely committed, this function returns the number of bytes outside the zone that has been committed. If the commitment range exactly matches the length of the zone, then this function returns zero.

impl<P> DataZone<P> where
    P: Clone + PartialEq
[src]

pub fn merge_zone(&self, other: &Self) -> Option<Self>[src]

Given another zone, attempt to construct a single zone which describes both uncommitted areas of the same data stream.

This function yields None if the two zones aren't compatible; otherwise, it will return a new zone whose uncommitted length encompasses that of both zones.

Ordering considerations

It is not necessary to consider if one zone is "before" another when merging. The merged zone will be constructed to describe a stream where the most amount of data possible has not yet been committed.

Trait Implementations

impl<P: Clone> Clone for DataZone<P>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<P: Debug> Debug for DataZone<P>[src]

Auto Trait Implementations

impl<P> Send for DataZone<P> where
    P: Send

impl<P> Sync for DataZone<P> where
    P: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.