mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00:00
In addition, metadata about the file, such as creation time, last access, and file size, are stored in the database
43 lines
1.1 KiB
Rust
43 lines
1.1 KiB
Rust
use ruma::ServerName;
|
|
use sha2::{digest::Output, Sha256};
|
|
|
|
use crate::Result;
|
|
|
|
use super::DbFileMeta;
|
|
|
|
pub trait Data: Send + Sync {
|
|
fn create_file_metadata(
|
|
&self,
|
|
sha256_digest: Output<Sha256>,
|
|
file_size: u64,
|
|
servername: &ServerName,
|
|
media_id: &str,
|
|
filename: Option<&str>,
|
|
content_type: Option<&str>,
|
|
) -> Result<()>;
|
|
|
|
fn search_file_metadata(&self, servername: &ServerName, media_id: &str) -> Result<DbFileMeta>;
|
|
|
|
#[allow(clippy::too_many_arguments)]
|
|
fn create_thumbnail_metadata(
|
|
&self,
|
|
sha256_digest: Output<Sha256>,
|
|
file_size: u64,
|
|
servername: &ServerName,
|
|
media_id: &str,
|
|
width: u32,
|
|
height: u32,
|
|
filename: Option<&str>,
|
|
content_type: Option<&str>,
|
|
) -> Result<()>;
|
|
|
|
// Returns the sha256 hash, filename and content_type and whether the media should be accessible via
|
|
/// unauthenticated endpoints.
|
|
fn search_thumbnail_metadata(
|
|
&self,
|
|
servername: &ServerName,
|
|
media_id: &str,
|
|
width: u32,
|
|
height: u32,
|
|
) -> Result<DbFileMeta>;
|
|
}
|