Enum malwaredb_server::db::DatabaseType
source · pub enum DatabaseType {
Postgres(Postgres),
}
Variants§
Postgres(Postgres)
Implementations§
source§impl DatabaseType
impl DatabaseType
pub async fn from_string(arg: &str) -> Result<Self>
sourcepub async fn authenticate(&self, uname: &str, password: &str) -> Result<String>
pub async fn authenticate(&self, uname: &str, password: &str) -> Result<String>
Check user credentials, return API key. Generate if it doesn’t exist.
sourcepub async fn db_info(&self) -> Result<DatabaseInformation>
pub async fn db_info(&self) -> Result<DatabaseInformation>
Retrieve information about the database
sourcepub async fn get_user_info(&self, uid: i32) -> Result<GetUserInfoResponse>
pub async fn get_user_info(&self, uid: i32) -> Result<GetUserInfoResponse>
Retrieve the names of the groups and sources the user is part of and has access to
sourcepub async fn get_known_data_types(&self) -> Result<Vec<FileType>>
pub async fn get_known_data_types(&self) -> Result<Vec<FileType>>
Retrieve the supported data type information
sourcepub async fn allowed_user_source(&self, uid: i32, sid: i32) -> Result<bool>
pub async fn allowed_user_source(&self, uid: i32, sid: i32) -> Result<bool>
Check that a user has been granted access data for the specific source
sourcepub async fn user_is_admin(&self, uid: i32) -> Result<bool>
pub async fn user_is_admin(&self, uid: i32) -> Result<bool>
Check to see if the user is an administrator. The user must be a member of the the admin group (group ID 0), or a one group below (a group with the parent group id of 0).
sourcepub async fn add_file(
&self,
meta: &FileMetadata,
known_type: KnownType<'_>,
uid: i32,
sid: i32,
ftype: i32
) -> Result<bool>
pub async fn add_file( &self, meta: &FileMetadata, known_type: KnownType<'_>, uid: i32, sid: i32, ftype: i32 ) -> Result<bool>
Add a file’s metadata to the database, returning true if this is a new entry
sourcepub async fn retrieve_sample(&self, uid: i32, hash: HashType) -> Result<String>
pub async fn retrieve_sample(&self, uid: i32, hash: HashType) -> Result<String>
Retrieve the SHA-256 hash of the sample while checking that the user is permitted to access to it
sourcepub async fn find_similar_samples(
&self,
uid: i32,
sim: &[(SimilarityHashType, String)]
) -> Result<Vec<SimilarSample>>
pub async fn find_similar_samples( &self, uid: i32, sim: &[(SimilarityHashType, String)] ) -> Result<Vec<SimilarSample>>
Given a collection of similarity hashes, find samples which are similar.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseType
impl Send for DatabaseType
impl Sync for DatabaseType
impl Unpin for DatabaseType
impl !UnwindSafe for DatabaseType
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more