[][src]Trait avocado::prelude::ThreadedClient

pub trait ThreadedClient: Sync {
    fn connect(host: &str, port: u16) -> Result<Self, Error>;
fn connect_with_options(
        host: &str,
        port: u16,
        ClientOptions
    ) -> Result<Self, Error>;
fn with_uri(uri: &str) -> Result<Self, Error>;
fn with_uri_and_options(
        uri: &str,
        options: ClientOptions
    ) -> Result<Self, Error>;
fn with_config(
        config: ConnectionString,
        options: Option<ClientOptions>,
        description: Option<TopologyDescription>
    ) -> Result<Self, Error>;
fn db(&self, db_name: &str) -> Arc<DatabaseInner>;
fn db_with_prefs(
        &self,
        db_name: &str,
        read_preference: Option<ReadPreference>,
        write_concern: Option<WriteConcern>
    ) -> Arc<DatabaseInner>;
fn acquire_stream(
        &self,
        read_pref: ReadPreference
    ) -> Result<(PooledStream, bool, bool), Error>;
fn acquire_write_stream(&self) -> Result<PooledStream, Error>;
fn get_req_id(&self) -> i32;
fn database_names(&self) -> Result<Vec<String>, Error>;
fn drop_database(&self, db_name: &str) -> Result<(), Error>;
fn is_master(&self) -> Result<bool, Error>;
fn add_start_hook(
        &mut self,
        hook: fn(Arc<ClientInner>, &CommandStarted)
    ) -> Result<(), Error>;
fn add_completion_hook(
        &mut self,
        hook: fn(Arc<ClientInner>, &CommandResult)
    ) -> Result<(), Error>; }

Required methods

fn connect(host: &str, port: u16) -> Result<Self, Error>

Creates a new Client directly connected to a single MongoDB server.

fn connect_with_options(
    host: &str,
    port: u16,
    ClientOptions
) -> Result<Self, Error>

Creates a new Client directly connected to a single MongoDB server with options.

fn with_uri(uri: &str) -> Result<Self, Error>

Creates a new Client connected to a complex topology, such as a replica set or sharded cluster.

fn with_uri_and_options(
    uri: &str,
    options: ClientOptions
) -> Result<Self, Error>

Creates a new Client connected to a complex topology, such as a replica set or sharded cluster, with options.

fn with_config(
    config: ConnectionString,
    options: Option<ClientOptions>,
    description: Option<TopologyDescription>
) -> Result<Self, Error>

Create a new Client with manual connection configurations. connect and with_uri should generally be used as higher-level constructors.

fn db(&self, db_name: &str) -> Arc<DatabaseInner>

Creates a database representation.

fn db_with_prefs(
    &self,
    db_name: &str,
    read_preference: Option<ReadPreference>,
    write_concern: Option<WriteConcern>
) -> Arc<DatabaseInner>

Creates a database representation with custom read and write controls.

fn acquire_stream(
    &self,
    read_pref: ReadPreference
) -> Result<(PooledStream, bool, bool), Error>

Acquires a connection stream from the pool, along with slave_ok and should_send_read_pref.

fn acquire_write_stream(&self) -> Result<PooledStream, Error>

Acquires a connection stream from the pool for write operations.

fn get_req_id(&self) -> i32

Returns a unique operational request id.

fn database_names(&self) -> Result<Vec<String>, Error>

Returns a list of all database names that exist on the server.

fn drop_database(&self, db_name: &str) -> Result<(), Error>

Drops the database defined by db_name.

fn is_master(&self) -> Result<bool, Error>

Reports whether this instance is a primary, master, mongos, or standalone mongod instance.

fn add_start_hook(
    &mut self,
    hook: fn(Arc<ClientInner>, &CommandStarted)
) -> Result<(), Error>

Sets a function to be run every time a command starts.

fn add_completion_hook(
    &mut self,
    hook: fn(Arc<ClientInner>, &CommandResult)
) -> Result<(), Error>

Sets a function to be run every time a command completes.

Loading content...

Implementations on Foreign Types

impl ThreadedClient for Arc<ClientInner>
[src]

Loading content...

Implementors

Loading content...