[−][src]Struct mongo_file_center::FileCenter
To store perennial files and temporary files in MongoDB.
Methods
impl FileCenter
[src]
impl FileCenter
pub fn new<H: AsRef<str>, D: AsRef<str>>(
host: H,
port: u16,
database: D
) -> Result<FileCenter, FileCenterError>
[src]
pub fn new<H: AsRef<str>, D: AsRef<str>>(
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]
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>
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]
pub fn set_file_size_threshold(
&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]
pub fn decrypt_id_token<S: AsRef<str>>(
&self,
id_token: S
) -> Result<ObjectId, FileCenterError>
Decrypt a ID token to an Object ID.
pub fn encrypt_id(&self, id: &ObjectId) -> IDToken
[src]
pub fn encrypt_id(&self, id: &ObjectId) -> IDToken
Encrypt an Object ID to an ID token.
pub fn encrypt_id_to_buffer(&self, id: &ObjectId, buffer: String) -> String
[src]
pub fn encrypt_id_to_buffer(&self, id: &ObjectId, buffer: String) -> String
Encrypt an Object ID to an ID token.
pub fn drop_database(self) -> Result<(), FileCenterError>
[src]
pub fn drop_database(self) -> Result<(), FileCenterError>
Drop the database.
pub fn drop_file_center(self) -> Result<(), FileCenterError>
[src]
pub fn drop_file_center(self) -> Result<(), FileCenterError>
Drop the file center.
pub fn get_file_item_by_id(
&self,
id: &ObjectId
) -> Result<Option<FileItem>, FileCenterError>
[src]
pub fn get_file_item_by_id(
&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]
pub fn delete_file_item_by_id(
&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: AsRef<str>>(
&self,
file_path: P,
file_name: Option<S>,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
pub fn put_file_by_path<P: AsRef<Path>, S: AsRef<str>>(
&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: AsRef<str>>(
&self,
buffer: Vec<u8>,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
pub fn put_file_by_buffer<S: AsRef<str>>(
&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: AsRef<str>>(
&self,
reader: R,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
pub fn put_file_by_reader<R: Read, S: AsRef<str>>(
&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: AsRef<str>>(
&self,
file_path: P,
file_name: Option<S>,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
pub fn put_file_by_path_temporarily<P: AsRef<Path>, S: AsRef<str>>(
&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: AsRef<str>>(
&self,
buffer: Vec<u8>,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
pub fn put_file_by_buffer_temporarily<S: AsRef<str>>(
&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: AsRef<str>>(
&self,
reader: R,
file_name: S,
mime_type: Option<Mime>
) -> Result<FileItem, FileCenterError>
[src]
pub fn put_file_by_reader_temporarily<R: Read, S: AsRef<str>>(
&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]
pub fn clear_garbage(&self) -> Result<(), FileCenterError>
Remove all unused files in GridFS and in the COLLECTION_FILES_NAME
collection.
Auto Trait Implementations
impl Send for FileCenter
impl Send for FileCenter
impl Sync for FileCenter
impl Sync for FileCenter
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
impl<T, U> TryInto for T where
U: TryFrom<T>,
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self