All Projects → lexhide → Xandra

lexhide / Xandra

Licence: isc
Fast, simple, and robust Cassandra driver for Elixir.

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to Xandra

Express Cassandra
Cassandra ORM/ODM/OGM for Node.js with optional support for Elassandra & JanusGraph
Stars: ✭ 163 (-31.8%)
Mutual labels:  cassandra
Ebook Chat App Spring Websocket Cassandra Redis Rabbitmq
Pro Java Clustering and Scalability: Building Real-Time Apps with Spring, Cassandra, Redis, WebSocket and RabbitMQ
Stars: ✭ 186 (-22.18%)
Mutual labels:  cassandra
Cass Operator
The DataStax Kubernetes Operator for Apache Cassandra
Stars: ✭ 208 (-12.97%)
Mutual labels:  cassandra
Spark Structured Streaming Examples
Spark Structured Streaming / Kafka / Cassandra / Elastic
Stars: ✭ 168 (-29.71%)
Mutual labels:  cassandra
Scalardb
Universal transaction manager
Stars: ✭ 178 (-25.52%)
Mutual labels:  cassandra
Firecamp
Serverless Platform for the stateful services
Stars: ✭ 194 (-18.83%)
Mutual labels:  cassandra
Dcos Commons
DC/OS SDK is a collection of tools, libraries, and documentation for easy integration of technologies such as Kafka, Cassandra, HDFS, Spark, and TensorFlow with DC/OS.
Stars: ✭ 162 (-32.22%)
Mutual labels:  cassandra
Alia
High performance Cassandra client for clojure
Stars: ✭ 224 (-6.28%)
Mutual labels:  cassandra
Phpfastcache
A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
Stars: ✭ 2,171 (+808.37%)
Mutual labels:  cassandra
Migrate
Database migrations. CLI and Golang library.
Stars: ✭ 2,315 (+868.62%)
Mutual labels:  cassandra
Dosa
DOSA is a data object abstraction layer
Stars: ✭ 172 (-28.03%)
Mutual labels:  cassandra
Gocql
Package gocql implements a fast and robust Cassandra client for the Go programming language.
Stars: ✭ 2,182 (+812.97%)
Mutual labels:  cassandra
Cassandra
A Docker Cassandra container
Stars: ✭ 198 (-17.15%)
Mutual labels:  cassandra
Holster
A place to keep useful golang functions and small libraries
Stars: ✭ 166 (-30.54%)
Mutual labels:  cassandra
Cassandra Operator
Kubernetes operator for Apache Cassandra
Stars: ✭ 215 (-10.04%)
Mutual labels:  cassandra
Cassandra Chef Cookbook
Chef cookbook for Apache Cassandra, DataStax Enterprise (DSE) and DataStax agent
Stars: ✭ 162 (-32.22%)
Mutual labels:  cassandra
Cassandradump
A data exporting tool for Cassandra inspired from mysqldump, with some additional slice and dice capabilities
Stars: ✭ 186 (-22.18%)
Mutual labels:  cassandra
Cassandra Reaper
Software to run automated repairs of cassandra
Stars: ✭ 235 (-1.67%)
Mutual labels:  cassandra
Gimel
Big Data Processing Framework - Unified Data API or SQL on Any Storage
Stars: ✭ 216 (-9.62%)
Mutual labels:  cassandra
Cqerl
Native Erlang CQL client for Cassandra
Stars: ✭ 201 (-15.9%)
Mutual labels:  cassandra

Xandra

Build Status Hex.pm

Fast, simple, and robust Cassandra driver for Elixir.

Cover image

Xandra is a Cassandra driver built natively in Elixir and focused on speed, simplicity, and robustness. This driver works exclusively with the Cassandra Query Language v3 (CQL3) and the native protocol versions 3 and 4.

Features

This library is in its early stages when it comes to features, but we're already successfully using it in production at Forza Football. Currently, the supported features are:

  • connection pooling with reconnections in case of connection loss
  • prepared queries (with local cache of prepared queries on a per-connection basis) and batch queries
  • page streaming
  • compression
  • clustering (random and priority load balancing for now) with support for autodiscovery of nodes in the cluster (same datacenter only for now)
  • customizable retry strategies for failed queries
  • user-defined types
  • authentication
  • SSL encryption

See the documentation for detailed explanation of how the supported features work.

Installation

Add the :xandra dependency to your mix.exs file:

def deps() do
  [{:xandra, "~> 0.11"}]
end

Then, run mix deps.get in your shell to fetch the new dependency.

Overview

The documentation is available on HexDocs.

Connections or pool of connections can be started with Xandra.start_link/1:

{:ok, conn} = Xandra.start_link(nodes: ["127.0.0.1:9042"])

This connection can be used to perform all operations against the Cassandra server.

Executing simple queries looks like this:

statement = "INSERT INTO users (name, postcode) VALUES ('Priam', 67100)"
{:ok, %Xandra.Void{}} = Xandra.execute(conn, statement, _params = [])

Preparing and executing a query:

with {:ok, prepared} <- Xandra.prepare(conn, "SELECT * FROM users WHERE name = ?"),
     {:ok, %Xandra.Page{}} <- Xandra.execute(conn, prepared, [_name = "Priam"]),
     do: Enum.to_list(page)

Xandra supports streaming pages:

prepared = Xandra.prepare!(conn, "SELECT * FROM subscriptions WHERE topic = :topic")
page_stream = Xandra.stream_pages!(conn, prepared, _params = [], page_size: 1_000)

# This is going to execute the prepared query every time a new page is needed:
page_stream
|> Enum.take(10)
|> Enum.each(fn page -> IO.puts("Got a bunch of rows: #{inspect(Enum.to_list(page))}") end)

Scylla support

Xandra supports Scylla (version 2.x) without the need to do anything in particular.

Contributing

To run tests, you will need Docker installed on your machine. This repository uses docker-compose to run multiple Cassandra instances in parallel on different ports to test different features (such as authentication or SSL encryption). To run normal tests, do this from the root of the project:

docker-compose up -d
mix test

The -d flags runs the instances as daemons in the background. Give it a minute between starting the services and running mix test since Cassandra takes a while to start. To stop the services, run docker-compose stop.

To run tests for Scylla, you'll need a different set of services and a different test task:

docker-compose --file docker-compose.scylladb.yml up -d
mix test.scylladb

Use docker-compose --file docker-compose.scylladb.yml stop to stop Scylla when done.

By default, tests run for native protocol v3 except for a few specific tests that run on native protocol v4. If you want to test the whole suite on native protocol v4, use:

CASSANDRA_NATIVE_PROTOCOL=v4 mix test

License

Xandra is released under the ISC license, see the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].