Skip to content

A simple data store library built on top of Git repository

License

Notifications You must be signed in to change notification settings

arun1729/gitstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitStore Build Status codecov

A simple key-value store based on Git repository. Get all the benefits of a Git repo such as revision history and tracking changes per user on a data store. These features are especially useful for storing and managing configuration files that are accessed and modified by multiple users/applications.

Example

GitStore gitStore = new GitStore("/tmp/test-db");
String content = "A new document to store into GitStore";
String docname = "document-1";
gitStore.connect("arun", "[email protected]");
gitStore.put(docname, content, "inserted new document into git store.");

Check git log

$cd /tmp/test-db
$git log
commit 03c8528435ada5e552ba561b4d69b3d3bad9b48d
Author: arun <[email protected]>
Date:   Thu Nov 9 12:18:54 2017 -0600

    inserted new document into git store.

Get content back

gitStore.get(docname)
A new document to store into GitStore

Storing data in partition

String content = "Test test Test test";
String docname = "test-doc";
DBPartition partName = new DBPartition("part/1");
gitStore.connect("arun", "[email protected]");
gitStore.inPartition(partName).put(docname, content, "created for testing");

Retrieving data from partition

String content = gitStore.inPartition(partName).get(docname);

Delete document and drop partition

gitStore.inPartition(partName).delete(docname, "removing file.");
gitStore.dropPartitionTree(partName, "dropping partition after testing.");

Maven dependency (only snaphot available currently.)

<dependency>
  <groupId>com.github.arun1729</groupId>
  <artifactId>gitstore</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

to include snapshot repo, add this to your repository list:

<repository>
  <id>maven-snapshots</id>
  <url>http://oss.sonatype.org/content/repositories/snapshots</url>
  <releases>
    <enabled>false</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>

Releases

No releases published

Packages

No packages published

Languages