Stargate concepts

Stargate is a framework used to customize all aspects of data access. It is deployed between client applications and a database to provide an abstraction layer that can be used to shape your data access to fit your application’s needs.

To understand the vision of this project, see the high-level architecture diagram below.

Stargate High-Level Architecture

Project architecture

Stargate is broken up into modules that fit into three broad categories:

  • API extensions

  • Persistence extensions

  • Authentication extensions.

The diagram below shows how these modules fit together.

Stargate High-Level Architecture

API extensions

API extensions are responsible for defining the API, handling and converting requests to database queries, dispatching requests to persistence services, and returning and serving response to clients.

There are currently extensions for the Cassandra Query Language (CQL), and REST and GraphQL APIs for CRUD access to data in tables with many more coming soon. These extensions use both the Authentication Extensions and the Persistence Extensions.

The REST API uses the auth-api to handle token access to the endpoints that are exposed by the Jetty-based Web Server. The GraphQL API also uses the token created with REST in the GrahpQL http header request to access the endpoints. The persistence-api is used to dispatch converted requests to the underlying storage engine. In the case of the REST API, you can see what this looks like in the RowsResource.

Persistence extensions

Persistence extensions are responsible for implementing the coordination layer to execute requests passed by API services to underlying data storage instances.

The Persistence extensions are currently Cassandra-centric as Cassandra is the first database we chose to implement. The extensions for Cassandra 3.11 and 4.0 use Cassandra’s coordinator concept and code to do the majority of the work.

Specifically, when using Stargate with one of Cassandra extensions Stargate nodes:

  • join the Cassandra ring as a coordinator node, a node that does not store data.

  • mock Cassandra system tables for native driver integration.

  • execute requests with Cassandra storage instances using Cassandra’s internal QueryHandler and QueryProcessor.

  • convert internal Cassandra objects and ResultSets to Stargate Datastore objects.

Authentication extensions

Authentication extensions are responsible for access control to Stargate’s APIs.

Currently there’s only an auth table-based service which stores generated access tokens in the database.

These extensions are used by the API Extensions to federate access. You can see an example of this in the REST API which requires a token to be passed to requests using the X-Cassandra-Token header. The GraphQL API and the Document API use the same token.