[−][src]Struct mongo_file_center::FileCenter
To store perennial files and temporary files in MongoDB.
Methods
impl FileCenter
[src]
pub fn new<H: AsRef<str>, D: AsRef<str>>(
host: H,
port: u16,
database: D
) -> Result<FileCenter, FileCenterError>
[src]
host: H,
port: u16,
database: D
) -> Result<FileCenter, FileCenterError>
Create a new FileCenter instance.
pub fn new_with_file_size_threshold<H: AsRef<str>, D: AsRef<str>>(
host: H,
port: u16,
database: D,
initial_file_size_threshold: i32
) -> Result<FileCenter, FileCenterError>
[src]
host: H,
port: u16,
database: D,
initial_file_size_threshold: i32
) -> Result<FileCenter, FileCenterError>
Create a new FileCenter instance with a custom initial file size threshold.
pub fn set_file_size_threshold(
&mut self,
file_size_threshold: i32
) -> Result<(), FileCenterError>
[src]
&mut self,
file_size_threshold: i32
) -> Result<(), FileCenterError>
Change the file size threshold.
pub fn decrypt_id_token<S: AsRef<str>>(
&self,
id_token: S
) -> Result<ObjectId, FileCenterError>
[src]
&self,
id_token: S
) -> Result<ObjectId, FileCenterError>
Decrypt a ID token to an Object ID.
pub fn encrypt_id(&self, id: &ObjectId) -> IDToken
[src]
Encrypt an Object ID to an ID token.
pub fn encrypt_id_to_buffer(&self, id: &ObjectId, buffer: String) -> String
[src]
Encrypt an Object ID to an ID token.
pub fn drop_database(self) -> Result<(), FileCenterError>
[src]
Drop the database.
pub fn drop_file_center(self) -> Result<(), FileCenterError>
[src]
Drop the file center.
pub fn get_file_item_by_id(
&self,
id: &ObjectId
) -> Result<Option<FileItem>, FileCenterError>
[src]
&self,
id: &ObjectId
) -> Result<Option<FileItem>, FileCenterError>
Get the file item via an Object ID.
pub fn delete_file_item_by_id(
&self,
id: &ObjectId
) -> Result<Option<u64>, FileCenterError>
[src]
&self,
id: &ObjectId
) -> Result<Option<u64>, FileCenterError>
Remove a file item via an Object ID.
pub fn put_file_by_path<P: AsRef<Path>, S: Into<String>>(
&self,
file_path: P,
file_name: Option<S>,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
&self,
file_path: P,
file_name: Option<S>,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
Input a file to the file center via a file path.
pub fn put_file_by_buffer<S: Into<String>>(
&self,
buffer: Vec<u8>,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
&self,
buffer: Vec<u8>,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
Input a file to the file center via a buffer.
pub fn put_file_by_reader<R: Read, S: Into<String>>(
&self,
reader: R,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
&self,
reader: R,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
Input a file to the file center via a reader.
pub fn put_file_by_path_temporarily<P: AsRef<Path>, S: Into<String>>(
&self,
file_path: P,
file_name: Option<S>,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
&self,
file_path: P,
file_name: Option<S>,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
Temporarily input a file to the file center via a file path.
pub fn put_file_by_buffer_temporarily<S: Into<String>>(
&self,
buffer: Vec<u8>,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
&self,
buffer: Vec<u8>,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
Temporarily input a file to the file center via a buffer.
pub fn put_file_by_reader_temporarily<R: Read, S: Into<String>>(
&self,
reader: R,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
&self,
reader: R,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
Temporarily input a file to the file center via a reader.
pub fn clear_garbage(&self) -> Result<(), FileCenterError>
[src]
Remove all unused files in GridFS and in the COLLECTION_FILES_NAME
collection.
pub fn get_mongo_client_db(&self) -> &Database
[src]
Get the instance of MongoDB Database.
Auto Trait Implementations
impl Send for FileCenter
impl Sync for FileCenter
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> Same for T
type Output = T
Should always be Self