Struct kinetic::Client [−] [src]

pub struct Client<Ch: KineticChannel<T>, T> {
    // some fields omitted
}

The Kinetic device client

The Kinetic device client represents the main point of access for this library

Example

use kinetic::Client;
use kinetic::commands::Put;
use std::default::Default;

let c = Client::new("127.0.0.1:8123").unwrap();
c.send(Put { key: "hello".as_bytes().to_vec(),
             value: "world".as_bytes().to_vec(),
             ..Default::default() }).unwrap();

Methods

impl Client<AsyncChannel, Receiver<Result>>

fn new<A: ToSocketAddrs>(addr: A) -> KineticResult<Client<AsyncChannel, Receiver<Result>>>

Creates a new Client backed by an AsyncChannel

Creates a new Client backed by an AsyncChannel by default and connects to it.

Arguments

  • addr - The address for the kinetic device.

Returns

Returns a KineticResult that will hold the Client if the connection was established succesfully.

impl<Ch: KineticChannel<T>, T> Client<Ch, T>

fn new_with_channel<A: ToSocketAddrs>(channel: Ch) -> KineticResult<Client<Ch, T>>

Creates a new Client with an specific KineticChannel

fn set_cluster_version(&mut self, value: i64)

fn get_config<'r>(&'r self) -> &'r Configuration

Gets the device Configuration received during handshake

fn get_limits<'r>(&'r self) -> &'r Limits

Gets the device Limits received during handshake

fn send<C: Command<R>, R: Response>(&self, cmd: C) -> KineticResult<R>

Sends a Command to the target device an waits for the Response

Arguments

  • cmd - The PinCommand to be sent.

fn send_with_pin<C: PinCommand<R>, R: Response>(&self, cmd: C, pin: Vec<u8>) -> KineticResult<R>

Sends a PinCommand to the target device an waits for the Response

Arguments

  • cmd - The PinCommand to be sent.
  • pin - The pin to be used.

impl Client<AsyncChannel, Receiver<Result>>

Client backed by an AsyncChannel

fn new_with_credentials<A: ToSocketAddrs>(addr: A, credentials: Credentials) -> KineticResult<Client<AsyncChannel, Receiver<Result>>>

fn send_future<C: Command<R>, R: Response + 'static>(&self, cmd: C) -> Future<KineticResult<R>>