Giter VIP home page Giter VIP logo

kvdb's Introduction

KVDB

KVDB is a database, accessible via a REST interface or websockets. Data are are stored on disk, with key-value mapped datas. Thoses key-value pairs are stored inside of tables.

Endpoints

GET /tables/:tableName/
    Show table informations (content).
    
GET /tables/:tableName/get/:key
	Show the value associated with key in table.

GET /tables/:tableName/put/?key={key}&value={value}
	Put the key-value pair in table. Returns if the value already exists.

GET /tables/:tableName/exist/:key
	Return true if the requested key exist.

GET /tables/:tableName/delete/:key
	Delete the key-value pair if it exist, return true if it deleted the key.

GET /tables/:tableName/clear
	Clear all the content of the table.

GET /tables/:tableName/size
	Return the number of key-value pair in table.

Security

In KVDB, security is based on tokens. For each tables, a Json Web Token (JWT) is generated. This token must be provided in each request to the database as a query-parameter called "token" like this :

GET /tables/:tableName/clear?token={token}

You can get a token (for testing purposes) using the following endpoint :

GET /token?user={userid}&table={tableName}

User ID must be registered in the users.json file before any usage !

WebSocket

In order to access datas of a table, you can use REST endpoints or Websocket. WebSocket is accessible via the following address:

ws://{ip}/tables/:tableName

To succesfully connect to the server, you need to provide the authentication token in query-parameter like this:

ws://{ip}/tables/:tableName?token={token}

Once authentication is done, the database return you the user id, this id must be sent in every request you will do later on.

From here, you can make every request you want on the table. WebSocket request are sent under the format of a string, each argument separated using this separator: §*/:

Here is a list of all the possible request and their parameters:

SHOW TABLE - show§*/:{user_id}

PUT - put§*/:{user_id}§*/:{key}§*/:{value}

GET - get§*/:{user_id}§*/:{key}

EXIST - exist§*/:{user_id}§*/:{key}

SIZE - size§*/:{user_id}

DELETE - delete§*/:{user_id}§*/:{key}

CLEAR - clear§*/:{user_id}

kvdb's People

Contributors

julienlavocat avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.