2022-09-07 13:25:51 +02:00
|
|
|
use crate::Result;
|
|
|
|
|
2024-05-09 15:59:08 -07:00
|
|
|
pub trait Data: Send + Sync {
|
2022-10-05 20:34:31 +02:00
|
|
|
fn create_file_metadata(
|
2024-03-17 01:42:30 -04:00
|
|
|
&self, sender_user: Option<&str>, mxc: String, width: u32, height: u32, content_disposition: Option<&str>,
|
|
|
|
content_type: Option<&str>,
|
2022-10-05 20:34:31 +02:00
|
|
|
) -> Result<Vec<u8>>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-02-21 20:34:11 -05:00
|
|
|
fn delete_file_mxc(&self, mxc: String) -> Result<()>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2022-09-07 13:25:51 +02:00
|
|
|
/// Returns content_disposition, content_type and the metadata key.
|
2022-10-05 20:34:31 +02:00
|
|
|
fn search_file_metadata(
|
|
|
|
&self, mxc: String, width: u32, height: u32,
|
|
|
|
) -> Result<(Option<String>, Option<String>, Vec<u8>)>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-02-22 00:08:08 -05:00
|
|
|
fn search_mxc_metadata_prefix(&self, mxc: String) -> Result<Vec<Vec<u8>>>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-03-02 11:00:53 -05:00
|
|
|
fn get_all_media_keys(&self) -> Result<Vec<Vec<u8>>>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-04-22 23:54:56 -04:00
|
|
|
// TODO: use this
|
|
|
|
#[allow(dead_code)]
|
2024-02-09 23:16:06 -05:00
|
|
|
fn remove_url_preview(&self, url: &str) -> Result<()>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-02-09 23:16:06 -05:00
|
|
|
fn set_url_preview(&self, url: &str, data: &super::UrlPreviewData, timestamp: std::time::Duration) -> Result<()>;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-02-09 23:16:06 -05:00
|
|
|
fn get_url_preview(&self, url: &str) -> Option<super::UrlPreviewData>;
|
2022-09-07 13:25:51 +02:00
|
|
|
}
|