[][src]Struct caspaxos_kv::Client

pub struct Client {
    pub known_servers: Vec<SocketAddr>,
    pub net: Net,
    pub cache: HashMap<Vec<u8>, CacheEntry>,
    pub processor: Option<Task<Result<()>>>,
}

Fields

known_servers: Vec<SocketAddr>net: Netcache: HashMap<Vec<u8>, CacheEntry>processor: Option<Task<Result<()>>>

Implementations

impl Client[src]

pub async fn ping<'_>(&'_ mut self) -> usize[src]

Send a Ping to the Server, which hopefully will respond with a Pong.

pub async fn get<K: AsRef<[u8]>, '_>(
    &'_ mut self,
    key: K
) -> Result<VersionedValue>
[src]

Get the value associated with a key, if any.

pub async fn set<K, V, '_>(
    &'_ mut self,
    key: K,
    value: V
) -> Result<Option<Vec<u8>>> where
    K: AsRef<[u8]>,
    V: AsRef<[u8]>, 
[src]

Set a key to a new value. Returns the previous set value.

pub async fn del<K: AsRef<[u8]>, '_>(
    &'_ mut self,
    key: K
) -> Result<Option<Vec<u8>>>
[src]

Delete a value associated with a key. Returns the previously set value, if any.

pub async fn cas<K: AsRef<[u8]>, '_>(
    &'_ mut self,
    key: K,
    old: VersionedValue,
    new: Option<Vec<u8>>
) -> Result<Result<VersionedValue, VersionedValue>>
[src]

Given a previous versioned value, either set (with Some) or delete (with None) a new value. Returns either Ok(new_version) or Err(current_versioned_value). Returns an error if the old value is not correctly guessed.

Trait Implementations

impl Debug for Client[src]

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,