Crate rincon_connector [] [src]

Connecting to an ArangoDB server

A connector implements the communication layer of the driver. It knows how to talk to an ArangoDB server, by using a transport protocol like HTTP or HTTPS and a serialization format like JSON or VelocyPack.

The Connector trait is defined in the rincon_core API. This crate provides some default implementations to be used out of the box.

Currently there is only one Connector implementation provided:

  • JsonHttpConnector : using JSON over HTTP/HTTPS

but more are planned to be added in the future.


Using a Connector is straight forward. Here is an example of how to use the JsonHttpConnector. Other Connectors are used in a similar way.

First we create an instance by calling the new() function. The new() function takes a DataSource and a handle of a reactor::Core as parameters.

The DataSource is a data struct that holds the parameters needed to connect to an ArangoDB server. It is defined by the rincon_core API. The reactor::Core is taken from the [tokio-core] crate.

use rincon_core::api::connector::Error;
use rincon_core::api::datasource::DataSource;
use rincon_connector::http::JsonHttpConnector;
use tokio_core::reactor::Core;
use std::str::FromStr;

fn create_connector() -> Result<JsonHttpConnector, Error> {

    let datasource = DataSource::from_str("http://localhost:8529")
        .expect("invalid URL for datasource")
        .with_basic_authentication("root", "s3cur3");

    let mut core = Core::new()?;

    let connector = JsonHttpConnector::new(datasource, &core.handle());

The connector we just created is used to execute method calls of the rincon_client API or is passed to the rincon_session API dependant on what API you want to use. For more details see the documentation of those crates.

TODO: add example on how to use connectors with JWT authentication.



Connectors that use HTTP/HTTPS as transport protocol.