#type-safe #database-client #driver #nosql #client #api-client

rincon_session

A synchronous session managed client API for the ArangoDB driver

1 unstable release

Uses old Rust 2015

0.1.0 Apr 15, 2018

#50 in #nosql


Used in rincon

Apache-2.0

700KB
16K SLoC

Rincon Session

Crates.io Docs.rs Apache-2.0 Join the chat

The [rincon_session] crate provides a convenient API for synchronous communication with an ArangoDB server.

The rincon_session API is a higher level API on top of the rincon_client API and provides additional features:

  • Convenient API for applications to communicate to an ArangoDB server. (READY)
    E.g. no need to manually specify the database and collection on each and every request.
  • Efficient handling of connections to the ArangoDB server (PLANNED)
  • Efficient execution of batch operations (PLANNED)
  • Convenient API for transaction handling (PLANNED)

Here is an example on how inserting a new document into an existing collection looks like:

#[derive(Debug, Clone, Serialize, Deserialize)]
struct Customer {
    name: String,
    age: u8,
}

// obtain a session reference for the existing collection named `customers`
let collection = database.use_collection_with_name("customers");

let customer = Customer {
    name: "Jane Doe".to_owned(),
    age: 42,
};

// insert the document and get the document header with document id, key and revision
let document_header = collection.insert_document(customer).unwrap();

The [rincon_session] crate is part of the Rincon ArangoDB Rust driver project.

Note: A similar but asynchronous API is provided by the rincon_session_async crate which is also part of the Rincon project.

Usage

To use the synchronous session API of this crate add this to your Cargo.toml:

[dependencies]
rincon_core = "0.1"
rincon_connection = "0.1"
rincon_session = "0.1"

And this to your crate root:

extern crate rincon_core;
extern crate rincon_connection;
extern crate rincon_session;

Important: As [rincon_session] depends on rincon_client it re-exports the crate features of rincon_client. Therefore please make sure that you specify the features for [rincon_session] that are suitable for the setup of your ArangoDB server the same way as specified for the rincon_client crate.

For example to use [rincon_session] with an ArangoDB server configured to use RocksDB in a cluster specify the dependency with features like so:

[dependencies]
rincon_session = { version = "0.1", default-features = false, features = ["rocksdb", "cluster"] }

License

Licensed under Apache License, Version 2.0
see LICENSE or http://www.apache.org/licenses/LICENSE-2.0 for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Dependencies

~13MB
~244K SLoC