Code Monkey home page Code Monkey logo

cassanova's Introduction

Archived code provided for historical interest only

This implements an obsolete Cassandra protocol in an obsolete version of Python. Do not use!


Cassanova

Cassanova is a fake Cassandra cluster. It runs in a single Python thread and is very lightweight for startup and shutdown- making it particularly useful for automated testing of Cassandra client interfaces and libraries.

Features:

  • Passes most of the Cassandra Thrift system tests!
  • Can mimic multiple nodes on different network interfaces
  • Easy to start and stop
  • Implemented as a Twisted Service, so it can share a process and reactor with your own Twisted code

What it does not support (yet?):

  • Partitioners other than RandomPartitioner
  • Indexes
  • Column validators or custom comparators
  • TTLs
  • Consistency levels (there's only one actual data store between all "nodes")
  • Write to disk (everything is lost when the process exits)
  • CQL (durr)
  • describe_splits (durr)
  • Perform efficiently (data is stored according to what was easiest to write, not what would be most efficient for writes or lookups)

Using

Requirements: Python (2.5 or higher), Twisted Matrix (8.0 or higher, I think), Thrift python library

The simplest way to run Cassanova is with the twistd tool. To run in the foreground and log to the console, listening on the default port (12379):

twistd -noy test.tap

To fork and run in the background, leaving a pid file:

twistd -y test.tap --pidfile whatever.pid --logfile cassanova.log

To change the listening port, set the $CASSANOVA_CLUSTER_PORT environment variable.

To run the test suite, have a Cassandra 0.7 source tree handy (I've been working against the 0.7.3 branch, so I know it works there), make sure the nose test coverage tool is installed, and run:

./run_tests.sh ~/path/to/cassandra-tree

Code overview

All the real code is in cassanova.py. The more important classes are:

  • CassanovaInterface: Provides the implementation of each of the supported Thrift calls. Corresponds to a single Thrift connection to the service.
  • CassanovaNode: Corresponds to a single (fake) Cassandra node, listening on its own interface. You'll need to have a local network interface for each node you want to run.
  • CassanovaService: The central service, which holds the schema and data. Corresponds to a whole cluster. The add_node method is used to instantiate new listening CassanovaNodes, given a unique network interface.

There is short explanation of the way data is stored in memory at the top of cassanova.py.

cassanova's People

Contributors

nickmbailey avatar jbellis avatar

Watchers

Ken Nordquist avatar Kiyu Gabriel avatar Jim Dickinson avatar Sergio Bossa avatar  avatar Jeremy Hanna avatar Rob Deeb avatar Silas Sao avatar Patrick McFadin avatar Gianluca Righetto avatar mck avatar Jeremy avatar Richard Hamlin avatar Jaroslaw Grabowski avatar Jonathan Shook avatar Brandon Bordeaux avatar Kathryn Erickson avatar Frank Rosner avatar simplyshankar avatar John Smart avatar Eric Borczuk avatar  avatar Mike Fortman avatar javaamtho|pg avatar Mary Grygleski avatar  avatar Christian Young avatar Ryan Springer avatar  avatar  avatar  avatar  avatar Andrey Yegorov avatar Enrico Olivelli avatar Shaunak Das avatar Miles Garnsey avatar Dr. George Cross IV avatar Tiago Laureano Alves avatar Chun Gao avatar Ayman Khalil avatar Michael Rains avatar Ryan Smith avatar  avatar Madhavan avatar David Jones-Gilardi avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.