mithril_aggregator/file_uploaders/
interface.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use async_trait::async_trait;
use mithril_common::StdResult;
use std::path::Path;

/// FileUri represents a file URI used to identify the file's location
#[derive(Debug, PartialEq, Clone)]
pub struct FileUri(pub String);

impl From<FileUri> for String {
    fn from(file_uri: FileUri) -> Self {
        file_uri.0
    }
}

/// FileUploader represents a file uploader interactor
#[cfg_attr(test, mockall::automock)]
#[async_trait]
pub trait FileUploader: Sync + Send {
    /// Upload a file
    async fn upload(&self, filepath: &Path) -> StdResult<FileUri>;
}