Skip to main content

ContentPut

Trait ContentPut 

pub trait ContentPut: Send {
    // Required methods
    fn size(&self) -> u64;
    fn written(&self) -> u64;
    fn append(
        &mut self,
        offset: u64,
        chunk: &[u8],
    ) -> Result<u64, ActionHostError>;
    fn finish(self: Box<Self>) -> Result<String, ActionHostError>;
}
Expand description

One upload in progress, owned by the session that began it: dropped unfinished (the session ended), it stores nothing.

Required Methods§

fn size(&self) -> u64

The size the upload began with.

fn written(&self) -> u64

Bytes accepted so far.

fn append(&mut self, offset: u64, chunk: &[u8]) -> Result<u64, ActionHostError>

Accept chunk at offset, answering the bytes accepted so far. offset must be exactly what was accepted so far, so a chunk sent again is refused, never stored twice; the refusal names the offset to resume at.

fn finish(self: Box<Self>) -> Result<String, ActionHostError>

Store the content and answer its reference, tilo.content:<hash>.

Implementors§