pub struct RemoteDatabase { /* private fields */ }Expand description
A client connection to a remote Akar server.
Created via RemoteDatabase::connect_tcp (or crate::Database::connect_tcp).
Executes queries over a length-prefixed JSON protocol; the server holds the
database open, so the client never touches the database directory or its
file locks.
Implementations§
Source§impl RemoteDatabase
impl RemoteDatabase
Sourcepub fn connect_tcp(addr: impl Into<String>) -> Result<Self, String>
pub fn connect_tcp(addr: impl Into<String>) -> Result<Self, String>
Connect to an Akar server listening at addr (e.g. "127.0.0.1:9876").
Sourcepub fn connect_with_token(
addr: impl Into<String>,
token: String,
) -> Result<Self, String>
pub fn connect_with_token( addr: impl Into<String>, token: String, ) -> Result<Self, String>
Connect with an authentication token. The token is sent with every request; the server rejects connections without a valid token.
Sourcepub fn query(&self, query_str: &str) -> Result<WireResponse, String>
pub fn query(&self, query_str: &str) -> Result<WireResponse, String>
Execute a Cypher query on the remote database.
Mirrors crate::Connection::query: returns the response on success and
an error message when the query failed (including OCC WriteConflicts).
Sourcepub fn query_with_params(
&self,
query_str: &str,
params: HashMap<String, Value>,
) -> Result<WireResponse, String>
pub fn query_with_params( &self, query_str: &str, params: HashMap<String, Value>, ) -> Result<WireResponse, String>
Execute a parameterized Cypher query.
params is a map of parameter names (without the $ prefix) to JSON
values. The server binds them via the prepared-statement pipeline.
Sourcepub fn ping_op(&self) -> Result<WireResponse, String>
pub fn ping_op(&self) -> Result<WireResponse, String>
Send a liveness check (op: "ping").
Sourcepub fn flush(&self) -> Result<WireResponse, String>
pub fn flush(&self) -> Result<WireResponse, String>
Force a CHECKPOINT to persist all data to disk (op: "flush").
Sourcepub fn stats(&self) -> Result<WireResponse, String>
pub fn stats(&self) -> Result<WireResponse, String>
Request server statistics (op: "stats").
Sourcepub fn export_db(&self, path: &str) -> Result<WireResponse, String>
pub fn export_db(&self, path: &str) -> Result<WireResponse, String>
Export the database to path (op: "export").
Sourcepub fn shutdown_server(&self) -> Result<WireResponse, String>
pub fn shutdown_server(&self) -> Result<WireResponse, String>
Request graceful server shutdown (op: "shutdown").
Sourcepub fn dream_control(&self, action: &str) -> Result<WireResponse, String>
pub fn dream_control(&self, action: &str) -> Result<WireResponse, String>
Send a dream_control request (op: "dream_control").
Auto Trait Implementations§
impl !Freeze for RemoteDatabase
impl RefUnwindSafe for RemoteDatabase
impl Send for RemoteDatabase
impl Sync for RemoteDatabase
impl Unpin for RemoteDatabase
impl UnsafeUnpin for RemoteDatabase
impl UnwindSafe for RemoteDatabase
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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> ⓘ
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> ⓘ
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 more