Struct skytable::sync::Connection

source ·
pub struct Connection { /* private fields */ }
Available on crate feature sync only.
Expand description

A database connection over Skyhash/TCP

Implementations§

source§

impl Connection

source

pub fn new(host: &str, port: u16) -> SkyResult<Self>

Create a new connection to a Skytable instance hosted on host and running on port

source§

impl Connection

source

pub fn run_query<T: FromSkyhashBytes, Q: AsRef<Query>>( &mut self, query: Q ) -> SkyResult<T>

Runs a query using Self::run_query_raw and attempts to return a type provided by the user

source

pub fn run_query_raw<Q: AsRef<Query>>(&mut self, query: Q) -> SkyResult<Element>

This function will write a Query to the stream and read the response from the server. It will then determine if the returned response is complete or incomplete or invalid and return an appropriate variant of Error wrapped in [IoResult] for any I/O errors that may occur

Panics

This method will panic:

  • if the Query supplied is empty (i.e has no arguments) This function is a subroutine of run_query used to parse the response packet
source

pub fn run_simple_query(&mut self, query: &Query) -> SkyQueryResult

👎Deprecated since 0.7.0: this will be removed in a future release. consider using <code>run_query_raw</code> instead
source

pub fn run_pipeline(&mut self, pipeline: Pipeline) -> SkyResult<Vec<Element>>

Runs a pipelined query. See the Pipeline documentation for a guide on usage

Trait Implementations§

source§

impl Debug for Connection

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Actions for Twhere T: SyncSocket,

source§

fn dbsize<'s>(&'s mut self) -> SkyResult<u64>

Available on crate feature sync only.
Get the number of keys present in the database
source§

fn del<'s>(&'s mut self, key: impl IntoSkyhashAction + 's) -> SkyResult<u64>

Available on crate feature sync only.
Deletes a single or a number of keys Read more
source§

fn exists<'s>(&'s mut self, key: impl IntoSkyhashAction + 's) -> SkyResult<u64>

Available on crate feature sync only.
Checks if a key (or keys) exist(s) Read more
source§

fn flushdb<'s>(&'s mut self) -> SkyResult<()>

Available on crate feature sync only.
Removes all the keys present in the database
source§

fn get<'s, T: FromSkyhashBytes>( &'s mut self, key: impl IntoSkyhashBytes + 's ) -> SkyResult<T>

Available on crate feature sync only.
Get the value of a key Read more
source§

fn keylen<'s>(&'s mut self, key: impl IntoSkyhashBytes + 's) -> SkyResult<u64>

Available on crate feature sync only.
Get the length of a key Read more
source§

fn lskeys<'s, T: FromSkyhashBytes>(&'s mut self, count: u64) -> SkyResult<T>

Available on crate feature sync only.
Returns a vector of keys Read more
source§

fn mget<'s, T: FromSkyhashBytes>( &'s mut self, keys: impl IntoSkyhashAction + 's ) -> SkyResult<T>

Available on crate feature sync only.
Get multiple keys Read more
source§

fn mksnap<'s>(&'s mut self) -> SkyResult<SnapshotResult>

Available on crate feature sync only.
Creates a snapshot Read more
source§

fn mset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>( &'s mut self, keys: impl GetIterator<T> + 's, values: impl GetIterator<U> + 's ) -> SkyResult<u64>

Available on crate feature sync only.
Sets the value of multiple keys and values and returns the number of keys that were set Read more
source§

fn mupdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>( &'s mut self, keys: impl GetIterator<T> + 's, values: impl GetIterator<U> + 's ) -> SkyResult<u64>

Available on crate feature sync only.
Updates the value of multiple keys and values and returns the number of keys that were updated Read more
source§

fn pop<'s, T: FromSkyhashBytes>( &'s mut self, keys: impl IntoSkyhashBytes + 's ) -> SkyResult<T>

Available on crate feature sync only.
Consumes a key if it exists Read more
source§

fn mpop<'s, T: FromSkyhashBytes>( &'s mut self, keys: impl IntoSkyhashAction + 's ) -> SkyResult<T>

Available on crate feature sync only.
Consumes the provided keys if they exist Read more
source§

fn sdel<'s>(&'s mut self, keys: impl IntoSkyhashAction + 's) -> SkyResult<bool>

Available on crate feature sync only.
Deletes all the provided keys if they exist or doesn’t do anything at all. This method will return true if all the provided keys were deleted, else it will return false Read more
source§

fn set<'s>( &'s mut self, key: impl IntoSkyhashBytes + 's, value: impl IntoSkyhashBytes + 's ) -> SkyResult<bool>

Available on crate feature sync only.
Set the value of a key Read more
source§

fn sset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>( &'s mut self, keys: impl GetIterator<T> + 's, values: impl GetIterator<U> + 's ) -> SkyResult<bool>

Available on crate feature sync only.
Sets the value of all the provided keys or does nothing. This method will return true if all the keys were set or will return false if none were set Read more
source§

fn supdate<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>( &'s mut self, keys: impl GetIterator<T> + 's, values: impl GetIterator<U> + 's ) -> SkyResult<bool>

Available on crate feature sync only.
Updates the value of all the provided keys or does nothing. This method will return true if all the keys were updated or will return false if none were updated. Read more
source§

fn update<'s>( &'s mut self, key: impl IntoSkyhashBytes + 's, value: impl IntoSkyhashBytes + 's ) -> SkyResult<()>

Available on crate feature sync only.
Update the value of a key Read more
source§

fn uset<'s, T: IntoSkyhashBytes + 's, U: IntoSkyhashBytes + 's>( &'s mut self, keys: impl GetIterator<T> + 's, values: impl GetIterator<U> + 's ) -> SkyResult<u64>

Available on crate feature sync only.
Updates or sets all the provided keys and returns the number of keys that were set Read more
source§

fn auth_claim<'s>(&'s mut self, origin_key: OriginKey) -> SkyResult<String>

Available on crate feature sync only.
Attempt to claim the root account using the given origin_key. This will return the root user token
source§

fn auth_login<'s>(&'s mut self, user: &'s str, token: &'s str) -> SkyResult<()>

Available on crate feature sync only.
Attempt to authenticate using the given user and token
source§

fn auth_logout<'s>(&'s mut self) -> SkyResult<()>

Available on crate feature sync only.
Attempt to log out
source§

fn auth_restore<'s>( &'s mut self, origin_key: OriginKey, user: &'s str ) -> SkyResult<String>

Available on crate feature sync only.
Attempt to restore the user account using the origin_key. This will return the new token for the given user
source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Ddl for Twhere T: SyncSocket,

source§

fn switch<'s, T: IntoSkyhashBytes + 's>( &'s mut self, entity: T ) -> SkyResult<()>

Available on crate feature sync only.
This function switches to the provided entity. Read more
source§

fn create_keyspace<'s>( &'s mut self, ks: impl IntoSkyhashBytes + 's ) -> SkyResult<bool>

Available on crate feature sync only.
Create the provided keyspace Read more
source§

fn create_table<'s>( &'s mut self, table: impl CreateTableIntoQuery + 's ) -> SkyResult<()>

Available on crate feature sync only.
Create a table from the provided configuration
source§

fn drop_table<'s>( &'s mut self, table: impl IntoSkyhashBytes + 's ) -> SkyResult<bool>

Available on crate feature sync only.
Drop the provided table Read more
source§

fn drop_keyspace<'s>( &'s mut self, keyspace: impl IntoSkyhashBytes + 's, force: bool ) -> SkyResult<()>

Available on crate feature sync only.
Drop the provided keyspace
source§

fn whereami<'s>(&'s mut self) -> SkyResult<WhereAmI>

Available on crate feature sync only.
Check what keyspace this connection is currently connected to
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.