pub trait Database: Sync + Send {
Show 14 methods // Required methods fn new(db_path: &str) -> Result<Self, Error> where Self: Sized; fn create_database_tables(&self) -> Result<(), Error>; fn drop_database_tables(&self) -> Result<(), Error>; fn load_persistent_torrents<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<(InfoHash, u32)>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_keys<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<ExpiringKey>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_whitelist<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<InfoHash>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save_persistent_torrent<'life0, 'life1, 'async_trait>( &'life0 self, info_hash: &'life1 InfoHash, completed: u32 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_info_hash_from_whitelist<'life0, 'life1, 'async_trait>( &'life0 self, info_hash: &'life1 InfoHash ) -> Pin<Box<dyn Future<Output = Result<Option<InfoHash>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_info_hash_to_whitelist<'life0, 'async_trait>( &'life0 self, info_hash: InfoHash ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn remove_info_hash_from_whitelist<'life0, 'async_trait>( &'life0 self, info_hash: InfoHash ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_key_from_keys<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 Key ) -> Pin<Box<dyn Future<Output = Result<Option<ExpiringKey>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_key_to_keys<'life0, 'life1, 'async_trait>( &'life0 self, auth_key: &'life1 ExpiringKey ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_key_from_keys<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 Key ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided method fn is_info_hash_whitelisted<'life0, 'life1, 'async_trait>( &'life0 self, info_hash: &'life1 InfoHash ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}

Required Methods§

source

fn new(db_path: &str) -> Result<Self, Error>where Self: Sized,

.

Errors

Will return r2d2::Error if db_path is not able to create a database.

source

fn create_database_tables(&self) -> Result<(), Error>

.

Errors

Will return Error if unable to create own tables.

source

fn drop_database_tables(&self) -> Result<(), Error>

Errors

Will return Err if unable to drop tables.

source

fn load_persistent_torrents<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<(InfoHash, u32)>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn load_keys<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<ExpiringKey>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn load_whitelist<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Vec<InfoHash>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn save_persistent_torrent<'life0, 'life1, 'async_trait>( &'life0 self, info_hash: &'life1 InfoHash, completed: u32 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_info_hash_from_whitelist<'life0, 'life1, 'async_trait>( &'life0 self, info_hash: &'life1 InfoHash ) -> Pin<Box<dyn Future<Output = Result<Option<InfoHash>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn add_info_hash_to_whitelist<'life0, 'async_trait>( &'life0 self, info_hash: InfoHash ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn remove_info_hash_from_whitelist<'life0, 'async_trait>( &'life0 self, info_hash: InfoHash ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn get_key_from_keys<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 Key ) -> Pin<Box<dyn Future<Output = Result<Option<ExpiringKey>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn add_key_to_keys<'life0, 'life1, 'async_trait>( &'life0 self, auth_key: &'life1 ExpiringKey ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn remove_key_from_keys<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 Key ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

source

fn is_info_hash_whitelisted<'life0, 'life1, 'async_trait>( &'life0 self, info_hash: &'life1 InfoHash ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§