cassitory

Library to manage redundancy tables in Cassandra

License

License

MIT
GroupId

GroupId

uk.co.caeldev
ArtifactId

ArtifactId

cassitory
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

cassitory
Library to manage redundancy tables in Cassandra
Project URL

Project URL

https://github.com/caelcs/cassitory
Source Code Management

Source Code Management

https://github.com/caelcs/cassitory.git

Download cassitory

How to add to project

<!-- https://jarcasting.com/artifacts/uk.co.caeldev/cassitory/ -->
<dependency>
    <groupId>uk.co.caeldev</groupId>
    <artifactId>cassitory</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/uk.co.caeldev/cassitory/
implementation 'uk.co.caeldev:cassitory:1.0.0'
// https://jarcasting.com/artifacts/uk.co.caeldev/cassitory/
implementation ("uk.co.caeldev:cassitory:1.0.0")
'uk.co.caeldev:cassitory:jar:1.0.0'
<dependency org="uk.co.caeldev" name="cassitory" rev="1.0.0">
  <artifact name="cassitory" type="jar" />
</dependency>
@Grapes(
@Grab(group='uk.co.caeldev', module='cassitory', version='1.0.0')
)
libraryDependencies += "uk.co.caeldev" % "cassitory" % "1.0.0"
[uk.co.caeldev/cassitory "1.0.0"]

Dependencies

runtime (6)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3
com.google.guava : guava jar 27.1-jre
com.datastax.cassandra : cassandra-driver-mapping jar 3.7.1
com.datastax.cassandra : cassandra-driver-core jar 3.7.1
com.squareup : javapoet jar 1.11.1
org.apache.commons : commons-text jar 1.6

Project Modules

There are no modules declared in this project.

Cassitory

Development status Build Status Coverage Status Maven Central

Cassitory allows you to handle redundancy tables in Cassandra (In case that Apache Spark is not an option or to complex for your needs)

In a normal scenario you would have to define a cassandra entity per table that holds the cassandra annotations, and for each of them a Repository that will be used by your service coordinating all the write operations and making sure that you persist to both tables by using both repositories, therefore you will have to create one instance per cassandra entity to persist.

The idea behind Cassitory is to hide all that complexity from you. Although you will still need to have your cassandra entities but no Repositories, no creation of multiple Cassandra entity instances.
Instead you will have DTO that contains the data and knows how to map to each Cassandra entity and a Single repository to handle all the persistence layer to the multiple tables. Based on the mapping it will create an instance of each Cassandra Entity and save it.

ASYNC is awesome! so you can save and delete using async operations but also provides a sync way in case that you have go down that route.

NO REFLEXION: Cassitory does not use reflexion to do all the operations that provides and because of it there are some compromises if you want to use it.

  • Your Cassandra entities must have a Getters and Setters.
  • Your DTO must have Getters.

Cassitory use annotation processing to generate code than otherwise you would have to write it and it is quite good that if there is any error you would get it at compile time.

Important Release Note:

  • up to 0.2.1: supports only Mappers Repositories
  • higher than 1.0.0: support for Mappers and Prepered statements

Motivation

it is well known that Cassandra recommends de-normalisation of your model. Meaning that in order to support different search criteria for searching the data, Cassandra recommends to create a redundancy table having as partition key the fields that you want search for. Applying this pattern in your application could be very difficult to maintain. it would be nice to have a generic repository that allowing you to have support multiple tables and also execute queries and decide which table is the correct one.

Introduction

Cassitory is quite simple to use just following the steps and it will give you a Repository for your DTO ready to use in your application. Cassitory gives you two type of repositories.

Using Cassandra entities

The first one is by using Cassandra Entities Classes where you have to create your POJO and annotate them using Cassandra Object Mapper library. and apart of those POJO you will have to create your DTO entity and annotate it with Cassitory annotations and it will be used to map the values to your Cassandra entities. Here you have the annotations that you will have to use:

  • uk.co.caeldev.cassitory.entities.CassitoryEntity
  • uk.co.caeldev.cassitory.entities.Mapping

Using Prepared Statements and queries

with this repo you don't have to create your Cassandra entities, just your DTO annotated with Cassitory annotations. Here you have the annotations that you will have to use:

  • uk.co.caeldev.cassitory.statements.CassitoryEntity
  • uk.co.caeldev.cassitory.statements.Mapping

How to use it

Add to your gradle dependency to run the annotation processor and follow one of the two kind of repositories that Cassitory offers you.

finally annotate your DTO class with the Cassitory annotations that fits better for your project.

Versions

Version
1.0.0
0.2.1
0.2.0
0.1.3
0.1.2