Documentation

Get started within minutes.

Prerequisites

  • Supported Data Formats: Protocol Buffers and JSON (future)
  • RPC Framework: gRPC (recommended) or any implementation that supports HTTPS with SSL.
  • API Access Key: Requires RogueDB subscription. See Stripe Customer Portal for subscription details.
  • Subscription Identifier: Requires RogueDB subscription. See Stripe Customer Portal with subscription details.
  • RogueDB's Root CA Certificate: Available for download in GitHub repo.
  • RogueDB's Proto Files: Available for download in GitHub repo.
Assumptions

For the purpose of the code examples, all of RogueDB's proto files and Root CA Certificate are located in a folder called: roguedb. All of your proto files are located in a folder called: data_schemas.

Supporting functions implementation denoted by a comment of "See Reference Functions..." are excluded for clarity and not required to use RogueDB. The implementations are included at the bottom for your convenience.

Initial Connection

The following code establishes a connection to your RogueDB instance:

Authentication

RogueDB requires the Identifier and API Key (service account or user account). All queries have a field called "credentials" that needs to be initialized. See the following example of initializing the credentials:

Schema Registration

There are two primary steps for registering schema with a RogueDB database:

  • Identify the indices in the Protocol Buffer definition.
  • Provide the schemas to RogueDB.
Marking Indices

The first step of registering a Protocol Buffer is to mark the fields to be used for indexing with the pattern: // index-# (ex. // index-1). All schemas must have indices for use with RogueDB.

Guidelines for these fields are the following:

  • Fields selected for an index should form a unique identifier per entry.
  • For maximal performance, order indices in the following manner: 
    • Uniqueness: Prefer stock symbols vs. timestamps for ordering as symbols are unique to a batch of entries.
    • Granularity: Prefer stock symbols vs. aggregates as symbols allow for greater diversification and distribution of entries.
    • Uniqueness: Timestamps as the first index cause high collision due to commonality across entries.

An example inspired by financial market data:

Registering Schemas

The requirements to register your schema are the following:

  • Filename consists only of alphanumerical, underscore ("_"), and dash "-" characters.
  • Contents of the schema as a string.
  • Source type (ex. Protocol Buffers).

CRUD Operations

RogueDB does not require a structured querying language (eg. SQL) to execute. The API works similar to standard data structures in popular programming languages. All calls require providing credentials for authentication.

Test schema utilized in the examples:

Create

There are no differences in single versus batch create operations in terms of API.

Update

There are no differences in single versus batch update operations in terms of API.

Delete

There are no differences in single versus batch delete operations in terms of API.

Read

RogueDB's querying API allows programmatic composition by using logical operators (&&, ||) and comparison operators (==, !=, <, <=, >, >=) to replicate conditionals in your native progamming language. There are no joins, inner joins, outer joins, wheres, on, as, or any other special keywords required to be learned as a result.

A query can use an entire message with its indices or specifying individual fields as the operands in a query. RogueDB supports basic queries that involve the same logical operator (eg. homogenous application) and a single schema. There must be a 1:1 (operand : conditional) or 1:1:1 (operand : conditional : operand field) for the query to be valid.

Future support is coming for the following:

  • Complex queries that involve combining different logical operators for a single schema.
  • Support for multiple schemas in a single query.

The following example demonstrates using a schema's indices as the operand:

The following example demonstrates using a schema's fields as the operand:

User Roles and Permissions

RogueDB supports the creation of users and assigning of permissions on a schema level basis. Your API access key associated with your subscription has all permissions by default and cannot be revoked. Users have no permissions by default. The following permissions can be assigned:

  • Read: The ability to perform the Read operation (aka search) for a schema.
  • Write: The ability to perform the Create, Update, and Delete operations (aka insert, update, and remove) for a schema.
  • Execute: The ability to modify a schema's definition through the Configuration service.
  • Admin: Grants all permissions and overrides any existing permission.
Usage

RogueDB uses a case insensitive mapping of schema to permissions. The following is an example of User creation:

Permission Propagation

Permissions flow downwards from the parent schema. For instance, consider the following example:

Now presume we have a user, Foo, with the following permissions:

  • MedicalRecords: No permissions by default.
  • FinancialRecords: Read permissions.
  • Customer: Write and Read permissions.

Due to the composition of Customer including MedicalRecords and FinancialRecords, Foo can do the following when using Customer as the record:

  • MedicalRecords: No permissions by default => Write and Read permissions.
  • FinancialRecords: Read permissions => Write and Read permissions.

Careful consideration needs to be made when designing schemas to ensure permissions do not propagate in unexpected ways. As such, the Execute permission and Admin role should be given sparingly, if at all, and under additional security mechanisms.

Design Suggestion

Creation of a unique ID per customer with storage of MedicalRecords, FinancialRecords, and PII as separate schemas in the database prevents propagation of permissions. This further streamlines efficient storage and retrieval of data to only the required components versus the entirety of a record. UUIDs are an excellent mechanism for unique identifiers.

Consider the following as a more secure alternative:

Error Handling

RogueDB reports all error details in the Response message returned. The following example demonstrates parsing the errors returned:

Reference Functions

Functions used in the examples that are not required. Below are the implementation details for your convenience to get an even quicker start to using RogueDB.

Still have questions?

First Mover Advantage
Limited Availability Discounts

0-100 Users: 50% Discount. Promo: FIRST100
101-250 Users: 25% Discount. Promo: FIRST250
251-500 Users: 10% Discount. Promo: FIRST500