Skip to main content

DataStore

Trait DataStore 

Source
pub trait DataStore {
    type UploadType: SendUpload;

    // Required methods
    async fn create_upload(
        &self,
        info: UploadInfo,
    ) -> Result<Self::UploadType, TusError>;
    async fn get_upload(
        &self,
        id: &UploadId,
    ) -> Result<Self::UploadType, TusError>;
}
Expand description

Core storage abstraction.

Implement this trait to plug in any persistence backend (filesystem, S3, etc.). The associated UploadType must implement all upload operations; return TusError::ExtensionNotEnabled from extension methods your store doesn’t support.

Required Associated Types§

Required Methods§

Source

async fn create_upload( &self, info: UploadInfo, ) -> Result<Self::UploadType, TusError>

Create a new upload slot and return a handle to it.

Source

async fn get_upload(&self, id: &UploadId) -> Result<Self::UploadType, TusError>

Retrieve an existing upload by ID.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<TraitVariantBlanketType: SendDataStore> DataStore for TraitVariantBlanketType

Source§

type UploadType = <TraitVariantBlanketType as SendDataStore>::UploadType