Skip to content

Commit

Permalink
Merge branch 'master' of github.com:synrc/kvs
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Nov 16, 2018
2 parents 4497e87 + d4bce78 commit 18d04da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
KVS: Erlang Abstract Term Database
==================================

=================================
[![Build Status](https://travis-ci.org/synrc/kvs.svg?branch=master)](https://travis-ci.org/synrc/kvs)

Features
Expand Down Expand Up @@ -56,8 +55,8 @@ Models
------

We have built with KVS a number of applications and came up with schema samples.
We grouped schemas by three category. KVS hides database access behind backend drivers
and provides high-level rich API to stored and extend following data:
We grouped schemas by three categories. KVS hides database access behind backend drivers
and provides high-level rich API to stored and extend the following data:

* **Core** — Acl, Users, Subscriptions, Feeds, Entries, Comments
* **Banking** — Account, Customer, Transaction, Item, Currency, Program, Card, Cashback
Expand All @@ -69,7 +68,7 @@ Applications
This Framework provides also a **feed** application for sequential consistency
and **cr** application for chain replication database on top of **kvs**.
All write requests with given object key will be handled by single processes
so you may not worry about concurrent changes of user feed tops.
so you may not worry about concurrent changes in user feed tops.

All write operations that are made to data with secondary indexes,
i.e. not like linked lists could be potentially handled without feed_server.
Expand All @@ -90,7 +89,7 @@ Currently **kvs** includes following store backends:
Configuring
-----------

First of all you need to tune your backend in the kvs application:
First of all, you need to tune your backend in the kvs application:

```erlang
{kvs, [{dba,store_mnesia}]},
Expand All @@ -106,15 +105,15 @@ store_kai
{version,"KVS KAI PURE XEN"}
```

Create database for single node:
Create a database for a single node:

```erlang
3> kvs:join().
[kvs] Mnesia Init
ok
```

You can also create database by joining to existing cluster:
You can also create a database by joining to existing cluster:

```erlang
3> kvs:join('kvs@synrc.com').
Expand Down Expand Up @@ -154,10 +153,9 @@ ok
Polymorphic Records
-------------------

The data in KVS represented as plain Erlang records. The first element of the tuple
as usual indicates the name of bucket. And the second element usually corresponds
The data in KVS represented as plain Erlang records. The first element of the tuple, as usual, indicates the name of a bucket. And the second element usually corresponds
to the index key field. Additional secondary indexes could be applied for stores
that supports 2i, e.g. kai, mnesia, riak, mongodb.
that support 2i, e.g. kai, mnesia, riak, mongodb.

Iterators
---------
Expand Down Expand Up @@ -250,7 +248,7 @@ of containers:
Extending Schema
----------------

Usually you need only specify custom mnesia indexes and tables tuning.
Usually, you need only specify custom mnesia indexes and tables tuning.
Riak, KAI and Redis backends don't need it. Group you table into table packages
represented as modules with handle_notice API.

Expand Down Expand Up @@ -286,14 +284,14 @@ Using KVS in real applications

Besides using KVS in production in a number of applications we have
built on top of KVS several products. The first product is Chain
Replication Database wit XA protocol. And second is social Feed
Replication Database with XA protocol. And second is social Feed
Server for web shops and social sites.

### Chain Replication Database

The **kvs** semantic is totally compatible with XA protocol.
Adding the object with PUT means only putting to database
while ADD operations provides linking to the chain's container.
while ADD operations provide linking to the chain's container.
Also linking operation LINK is provided separately.

```erlang
Expand Down
3 changes: 2 additions & 1 deletion src/kvs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ lookup(#block{},_) -> [].
rotate_new() ->
N = [ kvs:rotate(kvs:table(T)) || {T,_} <- fold_tables(),
length(proplists:get_value(attributes,info(last_disc(T)),[])) /= length((table(rname(T)))#table.fields) ],
io:format("Nonexistent: ~p~n",[N]), N.
%io:format("Nonexistent: ~p~n",[N]),
N.
rotate(#table{name=N}) ->
R = name(rname(N)),
init(setelement(#table.name,kvs:table(kvs:last_table(N)),R)),
Expand Down

0 comments on commit 18d04da

Please sign in to comment.