Struct mongo_file_center::FileCenter [−][src]
pub struct FileCenter { /* fields omitted */ }
Expand description
To store perennial files and temporary files in MongoDB.
Implementations
Create a new FileCenter instance.
pub async fn new_with_file_size_threshold<U: AsRef<str>>(
uri: U,
initial_file_size_threshold: u32
) -> Result<FileCenter, FileCenterError>
pub async fn new_with_file_size_threshold<U: AsRef<str>>(
uri: U,
initial_file_size_threshold: u32
) -> Result<FileCenter, FileCenterError>
Create a new FileCenter instance with a custom initial file size threshold.
Change the file size threshold.
pub async fn set_file_size_threshold(
&mut self,
file_size_threshold: u32
) -> Result<(), FileCenterError>
pub async fn set_file_size_threshold(
&mut self,
file_size_threshold: u32
) -> Result<(), FileCenterError>
Change the file size threshold.
Drop the database.
Drop the file center. But remain the database.
Check whether the file exists or not. If the file is temporary, it will still remain in the database.
Get the file item via an Object ID.
pub async fn delete_file_item_by_id(
&self,
file_id: ObjectId
) -> Result<Option<u64>, FileCenterError>
pub async fn delete_file_item_by_id(
&self,
file_id: ObjectId
) -> Result<Option<u64>, FileCenterError>
Remove a file item via an Object ID.
Input a file to the file center via a file path.
Input a file to the file center via a buffer.
Input a file to the file center via a reader.
Remove all unused file meta and file chunks in this file center.
pub fn decrypt_id_token<S: AsRef<str>>(
&self,
id_token: S
) -> Result<ObjectId, FileCenterError>
pub fn decrypt_id_token<S: AsRef<str>>(
&self,
id_token: S
) -> Result<ObjectId, FileCenterError>
Decrypt a ID token to an Object ID.
Encrypt an Object ID to an ID token.
Encrypt an Object ID to an ID token.