pub struct Database { /* private fields */ }
Expand description
A TypeDB database
Implementations§
Source§impl Database
impl Database
Sourcepub fn replicas_info(&self) -> Vec<ReplicaInfo>
pub fn replicas_info(&self) -> Vec<ReplicaInfo>
Returns the Replica
instances for this database.
Only works in TypeDB Cloud / Enterprise
§Examples
database.replicas_info()
Sourcepub fn primary_replica_info(&self) -> Option<ReplicaInfo>
pub fn primary_replica_info(&self) -> Option<ReplicaInfo>
Returns the primary replica for this database. Only works in TypeDB Cloud / Enterprise
§Examples
database.primary_replica_info()
Sourcepub fn preferred_replica_info(&self) -> Option<ReplicaInfo>
pub fn preferred_replica_info(&self) -> Option<ReplicaInfo>
Returns the preferred replica for this database. Operations which can be run on any replica will prefer to use this replica. Only works in TypeDB Cloud / Enterprise
§Examples
database.preferred_replica_info();
Sourcepub async fn schema(&self) -> Result<String>
pub async fn schema(&self) -> Result<String>
Returns a full schema text as a valid TypeQL define query string.
§Examples
database.schema().await;
Sourcepub async fn type_schema(&self) -> Result<String>
pub async fn type_schema(&self) -> Result<String>
Returns the types in the schema as a valid TypeQL define query string.
§Examples
database.type_schema().await;
Sourcepub async fn export_to_file(
&self,
schema_file_path: impl AsRef<Path>,
data_file_path: impl AsRef<Path>,
) -> Result
pub async fn export_to_file( &self, schema_file_path: impl AsRef<Path>, data_file_path: impl AsRef<Path>, ) -> Result
Export a database into a schema definition and a data files saved to the disk. This is a blocking operation and may take a significant amount of time depending on the database size.
§Arguments
schema_file_path
— The path to the schema definition file to be createddata_file_path
— The path to the data file to be created
§Examples
database.export_to_file(schema_path, data_path).await;
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request