Coder Social home page Coder Social logo

c-star-path-j's Introduction

This repository is the original C* Path project written in Java. It is also in the process of being ported to Scala at C* Path.

C* Path

Support for reading and writing structured objects in Cassandra. Structured objects can be accessed whole or in part by hierarchical paths.

For more information see the blog post at the eBuddy Tech Blog. There is also a presentation about C* Path from Cassandra Summit Europe 2013.

On writeToPath, the object is first converted into maps, lists, and simple objects with the help of Jackson JSON Processor (the fasterxml.com version). How objects are converted can be customized by using annotations supported by Jackson. These structures are then decomposed into key-value pairs where the keys are paths.

On readFromPath, the reverse process is used to recompose the key-value pairs back into a structured object or POJO.

Paths can be used to access structured data at different levels within the structure. A Path can also contain a special element that refers to an index within a list (or array or collection).

Note: Special support for Sets of simple values is also planned but not yet implemented. In the meantime sets can be modeled as maps.

###Example:

Class1 {
    Class2 a = new Class2();
}

Class2 {
    List<Class3> b = Arrays.asList(new Class3(42), new Class3(43));
}

Class3 {
    int c;

    Class3(int c) { this.c = c }
}

new Class1() would be decomposed into the following key-value pairs:

a/b/@0/c/ -> 42
a/b/@1/c/ -> 43

Maven Dependency

The artifacts are published at Maven Central. To include C* Path in your project, use one of the following dependencies. Generally either the CQL or thrift dependency is used, but not both.

To include CQL module:

<dependency>
    <groupId>com.ebuddy.cassandra</groupId>
    <artifactId>cql-data-access</artifactId>
    <version>2.4.2</version>
</dependency>

Or include the Thrift module:

<dependency>
    <groupId>com.ebuddy.cassandra</groupId>
    <artifactId>thrift-data-access</artifactId>
    <version>2.4.2</version>
</dependency>

api module

The main interface StructuredDataAccessSupport and helper classes.

cql module

Implementation of StructuredDataAccessSupport for CQL3. Uses the Datastax Java Driver for transport and low level operations.

To use structured data in a CQL3 table, the following data modeling rules apply:

  • The table should have one path column that is the first clustering key, i.e. the second column in the primary key after the partition key.
  • There should be one other column for the values.
  • The path and value columns should be typed as a textual type.

thrift module

Implementations of StructuredDataAccessSupport for standard column family access, using the Hector client library (and therefore Thrift) for transport and low level operations.

core module

Shared code used by both thrift and cql modules.

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.