[][src]Struct asuran::repository::backend::multifile::segment::SegmentHandler

pub struct SegmentHandler {
    input: Sender<SegmentHandlerCommand>,
    path: String,
}

Fields

input: Sender<SegmentHandlerCommand>path: String

Methods

impl SegmentHandler[src]

Warnings

  1. In order to ensure file locks are freed and all data is written to disk, you must ensure that you call the close function on all segments before the program terminates.

pub fn open(
    repository_path: impl AsRef<Path>,
    size_limit: u64,
    segments_per_directory: u64,
    chunk_settings: ChunkSettings,
    key: Key
) -> Result<SegmentHandler>
[src]

Opens a SegmentHandler, creating the data directory and the initial segment if it does not exist

Errors

Will error if creating/locking a segment fails, such as if the user does not have access to that directory, or if any other I/O error occurs

pub async fn read_chunk<'_>(
    &'_ mut self,
    location: SegmentDescriptor
) -> Result<Chunk>
[src]

pub async fn write_chunk<'_>(
    &'_ mut self,
    chunk: Chunk
) -> Result<SegmentDescriptor>
[src]

pub async fn close<'_>(&'_ mut self)[src]

Trait Implementations

impl Clone for SegmentHandler[src]

impl Debug for SegmentHandler[src]

Auto Trait Implementations

impl !RefUnwindSafe for SegmentHandler

impl Send for SegmentHandler

impl Sync for SegmentHandler

impl Unpin for SegmentHandler

impl !UnwindSafe for SegmentHandler

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

impl<T> WithSubscriber for T[src]