[][src]Struct mongo_file_center::FileCenter

pub struct FileCenter { /* fields omitted */ }

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]

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]

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]

Change the file size threshold.

pub fn decrypt_id_token<S: AsRef<str>>(
    &self,
    id_token: S
) -> Result<ObjectId, FileCenterError>
[src]

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]

Get the file item via an Object ID.

pub fn delete_file_item_by_id(
    &self,
    id: &ObjectId
) -> Result<Option<u64>, FileCenterError>
[src]

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]

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]

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]

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]

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]

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]

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> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Same for T

type Output = T

Should always be Self