Struct mongo_file_center::FileCenter
source · [−]pub struct FileCenter { /* private fields */ }Expand description
To store perennial files and temporary files in MongoDB.
Implementations
sourceimpl FileCenter
impl FileCenter
sourcepub async fn new<U: AsRef<str>>(uri: U) -> Result<FileCenter, FileCenterError>
pub async fn new<U: AsRef<str>>(uri: U) -> Result<FileCenter, FileCenterError>
Create a new FileCenter instance.
sourcepub 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.
sourceimpl FileCenter
impl FileCenter
sourcepub const fn get_file_size_threshold(&self) -> u32
pub const fn get_file_size_threshold(&self) -> u32
Change the file size threshold.
sourcepub 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.
sourcepub async fn drop_database(self) -> Result<(), FileCenterError>
pub async fn drop_database(self) -> Result<(), FileCenterError>
Drop the database.
sourcepub async fn drop_file_center(self) -> Result<(), FileCenterError>
pub async fn drop_file_center(self) -> Result<(), FileCenterError>
Drop the file center. But remain the database.
sourceimpl FileCenter
impl FileCenter
sourcepub async fn check_file_item_exist(
&self,
id: ObjectId
) -> Result<bool, FileCenterError>
pub async fn check_file_item_exist(
&self,
id: ObjectId
) -> Result<bool, FileCenterError>
Check whether the file exists or not. If the file is temporary, it will still remain in the database.
sourcepub async fn get_file_item_by_id(
&self,
id: ObjectId
) -> Result<Option<FileItem>, FileCenterError>
pub async fn get_file_item_by_id(
&self,
id: ObjectId
) -> Result<Option<FileItem>, FileCenterError>
Get the file item via an Object ID.
sourcepub 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.
sourceimpl FileCenter
impl FileCenter
sourceimpl FileCenter
impl FileCenter
sourceimpl FileCenter
impl FileCenter
sourceimpl FileCenter
impl FileCenter
sourcepub async fn clear_garbage(&self) -> Result<(), FileCenterError>
pub async fn clear_garbage(&self) -> Result<(), FileCenterError>
Remove all unused file meta and file chunks in this file center.
sourceimpl FileCenter
impl FileCenter
sourceimpl FileCenter
impl FileCenter
sourcepub 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.
sourcepub fn encrypt_id(&self, id: ObjectId) -> IDToken
pub fn encrypt_id(&self, id: ObjectId) -> IDToken
Encrypt an Object ID to an ID token.
sourcepub fn encrypt_id_to_buffer(&self, id: ObjectId, buffer: String) -> String
pub fn encrypt_id_to_buffer(&self, id: ObjectId, buffer: String) -> String
Encrypt an Object ID to an ID token.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for FileCenter
impl Send for FileCenter
impl Sync for FileCenter
impl Unpin for FileCenter
impl !UnwindSafe for FileCenter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more