revolt_database/models/file_hashes/
ops.rs

1use revolt_result::Result;
2
3use crate::FileHash;
4
5#[cfg(feature = "mongodb")]
6mod mongodb;
7mod reference;
8
9#[async_trait]
10pub trait AbstractAttachmentHashes: Sync + Send {
11    /// Insert a new attachment hash into the database.
12    async fn insert_attachment_hash(&self, hash: &FileHash) -> Result<()>;
13
14    /// Fetch an attachment hash entry by sha256 hash.
15    async fn fetch_attachment_hash(&self, hash: &str) -> Result<FileHash>;
16
17    /// Update an attachment hash nonce value.
18    async fn set_attachment_hash_nonce(&self, hash: &str, nonce: &str) -> Result<()>;
19
20    /// Delete attachment hash by id.
21    async fn delete_attachment_hash(&self, id: &str) -> Result<()>;
22}