ThistleDB - Simple JSON Database

Simple JSON database based on the file-access and server-client approach with the non-blocking server and the reactive (asynchronous non-blocking) client.

Design and Usage

ThistleDB is designed to run well with only limited resources (RAM and CPU).

Almost everything is based on the file-access.

Get Started

Prerequisites

Server

Default server port is 9658. Default server data folder is data. Default server cache expiration time (in minutes) is 20.

Download or Build

Download and unpack server binaries from the Download page (or compile it from the source code on GitHub).

Start from a Command-Line

$ cd bin
$ server
        

Server can be run with different settings, for more details type:

$ server --help
        

Client

Client implements Reactive Streams, Version 1.0.0.

Copy the Maven dependency into your project:

<dependency>
    <groupId>cz.net21.ttulka.thistledb</groupId>
    <artifactId>thistledb-client</artifactId>
    <version>1.0.0</version>
</dependency>
        

Open a client connection

import cz.net21.ttulka.thistledb.client.Client;
// ...
try (Client client = new Client()) {
    // ... work with the client
}
        

Create a collection:

client.executeCommand("CREATE test");
        

Put a document into the collection:

String json = "{\"patient\" : {\"id\" : \"123456789\", \"name\" : \"John Smith\"} }";
client.executeCommand("INSERT INTO test VALUES " + json);
        

Select the document from the collection (blocking):

String query = "SELECT * FROM test WHERE patient.id='123456789'";
List<String> result = client.executeQueryBlocking(query);

result.forEach(json -> System.out.println(json));
        

Select the document from the collection (non-blocking):

client.executeQuery(query).subscribe(System.out::println);
        

For more information read the Documentation.

License

Apache License, Version 2.0