DatabaseHandler

Struct DatabaseHandler 

Source
pub struct DatabaseHandler { /* private fields */ }
Expand description

Database handler for executing database commands

Implementations§

Source§

impl DatabaseHandler

Source

pub fn new(client: RestClient) -> Self

Source

pub async fn list(&self) -> Result<Vec<DatabaseInfo>>

List all databases (BDB.LIST)

Source

pub async fn info(&self, uid: u32) -> Result<DatabaseInfo>

Get specific database info (BDB.INFO)

Source

pub async fn get(&self, uid: u32) -> Result<DatabaseInfo>

Get specific database info (alias for info)

Source

pub async fn create( &self, request: CreateDatabaseRequest, ) -> Result<DatabaseInfo>

Create a new database (BDB.CREATE)

Source

pub async fn update(&self, uid: u32, updates: Value) -> Result<DatabaseInfo>

Update database configuration (BDB.UPDATE)

Source

pub async fn delete(&self, uid: u32) -> Result<()>

Delete a database (BDB.DELETE)

Source

pub async fn stats(&self, uid: u32) -> Result<Value>

Get database stats (BDB.STATS)

Source

pub async fn metrics(&self, uid: u32) -> Result<Value>

Get database metrics (BDB.METRICS)

Source

pub async fn start(&self, uid: u32) -> Result<Value>

Start database (BDB.START)

Source

pub async fn stop(&self, uid: u32) -> Result<Value>

Stop database (BDB.STOP)

Source

pub async fn restart(&self, uid: u32) -> Result<DatabaseActionResponse>

Restart database (BDB.RESTART)

Source

pub async fn export( &self, uid: u32, export_location: &str, ) -> Result<ExportResponse>

Export database (BDB.EXPORT)

Source

pub async fn import( &self, uid: u32, import_location: &str, flush: bool, ) -> Result<ImportResponse>

Import database (BDB.IMPORT)

Source

pub async fn flush(&self, uid: u32) -> Result<DatabaseActionResponse>

Flush database (BDB.FLUSH)

Source

pub async fn backup(&self, uid: u32) -> Result<BackupResponse>

Backup database (BDB.BACKUP)

Source

pub async fn restore( &self, uid: u32, backup_uid: Option<&str>, ) -> Result<DatabaseActionResponse>

Restore database from backup (BDB.RESTORE)

Source

pub async fn shards(&self, uid: u32) -> Result<Value>

Get database shards (BDB.SHARDS)

Source

pub async fn endpoints(&self, uid: u32) -> Result<Vec<EndpointInfo>>

Get database endpoints (BDB.ENDPOINTS)

Source

pub async fn optimize_shards_placement(&self, uid: u32) -> Result<Value>

Optimize shards placement (status) - GET

Source

pub async fn recover_status(&self, uid: u32) -> Result<Value>

Recover database (status) - GET

Source

pub async fn recover(&self, uid: u32) -> Result<DatabaseActionResponse>

Recover database - POST

Source

pub async fn resume_traffic(&self, uid: u32) -> Result<DatabaseActionResponse>

Resume traffic - POST

Source

pub async fn stop_traffic(&self, uid: u32) -> Result<DatabaseActionResponse>

Stop traffic - POST

Source

pub async fn rebalance(&self, uid: u32) -> Result<DatabaseActionResponse>

Rebalance database - PUT

Source

pub async fn revamp(&self, uid: u32) -> Result<DatabaseActionResponse>

Revamp database - PUT

Source

pub async fn backup_reset_status(&self, uid: u32) -> Result<Value>

Reset backup status - PUT

Source

pub async fn export_reset_status(&self, uid: u32) -> Result<Value>

Reset export status - PUT

Source

pub async fn import_reset_status(&self, uid: u32) -> Result<Value>

Reset import status - PUT

Source

pub async fn peer_stats(&self, uid: u32) -> Result<Value>

Peer stats for a database - GET

Source

pub async fn peer_stats_for(&self, uid: u32, peer_uid: u32) -> Result<Value>

Peer stats for a specific peer - GET

Source

pub async fn sync_source_stats(&self, uid: u32) -> Result<Value>

Sync source stats for a database - GET

Source

pub async fn sync_source_stats_for( &self, uid: u32, src_uid: u32, ) -> Result<Value>

Sync source stats for a specific source - GET

Source

pub async fn syncer_state(&self, uid: u32) -> Result<Value>

Syncer state (all) - GET

Source

pub async fn syncer_state_crdt(&self, uid: u32) -> Result<Value>

Syncer state for CRDT - GET

Source

pub async fn syncer_state_replica(&self, uid: u32) -> Result<Value>

Syncer state for replica - GET

Source

pub async fn passwords_delete(&self, uid: u32) -> Result<()>

Database passwords delete - DELETE

Source

pub async fn alerts_all(&self) -> Result<Value>

List all database alerts - GET

Source

pub async fn alerts_for(&self, uid: u32) -> Result<Value>

List alerts for a specific database - GET

Source

pub async fn alert_detail(&self, uid: u32, alert: &str) -> Result<Value>

Get a specific alert for a database - GET

Source

pub async fn crdt_source_alerts_all(&self) -> Result<Value>

CRDT source alerts - GET

Source

pub async fn crdt_source_alerts_for(&self, uid: u32) -> Result<Value>

CRDT source alerts for DB - GET

Source

pub async fn crdt_source_alerts_source( &self, uid: u32, source_id: u32, ) -> Result<Value>

CRDT source alerts for specific source - GET

Source

pub async fn crdt_source_alert_detail( &self, uid: u32, source_id: u32, alert: &str, ) -> Result<Value>

CRDT source alert detail - GET

Source

pub async fn replica_source_alerts_all(&self) -> Result<Value>

Replica source alerts - GET

Source

pub async fn replica_source_alerts_for(&self, uid: u32) -> Result<Value>

Replica source alerts for DB - GET

Source

pub async fn replica_source_alerts_source( &self, uid: u32, source_id: u32, ) -> Result<Value>

Replica source alerts for specific source - GET

Source

pub async fn replica_source_alert_detail( &self, uid: u32, source_id: u32, alert: &str, ) -> Result<Value>

Replica source alert detail - GET

Source

pub async fn upgrade( &self, uid: u32, module_name: &str, new_version: &str, ) -> Result<DatabaseActionResponse>

Upgrade database with new module version (BDB.UPGRADE)

Source

pub async fn reset_password( &self, uid: u32, new_password: &str, ) -> Result<DatabaseActionResponse>

Reset database password (BDB.RESET_PASSWORD)

Source

pub async fn availability(&self, uid: u32) -> Result<Value>

Check database availability

Source

pub async fn endpoint_availability(&self, uid: u32) -> Result<Value>

Check local database endpoint availability

Source

pub async fn create_v2(&self, request: Value) -> Result<DatabaseInfo>

Create database using v2 API (supports recovery plan)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,