Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rethinkdb reconnection #21

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 46 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# deepstream.io-storage-rethinkdb

[![Coverage Status](https://coveralls.io/repos/github/deepstreamIO/deepstream.io-storage-rethinkdb/badge.svg?branch=master)](https://coveralls.io/github/deepstreamIO/deepstream.io-storage-rethinkdb?branch=master)
[![npm](https://img.shields.io/npm/v/deepstream.io-storage-rethinkdb.svg)](https://www.npmjs.com/package/deepstream.io-storage-rethinkdb)
[![Dependency Status](https://david-dm.org/deepstreamIO/deepstream.io-storage-rethinkdb.svg)](https://david-dm.org/deepstreamIO/deepstream.io-storage-rethinkdb)
Expand All @@ -9,9 +10,10 @@

This connector uses [the npm rethinkdb package](https://www.npmjs.com/package/rethinkdb). Please have a look there for detailed options.

**Warning**: This plugin will automatically create a table, if it doesn't exist yet. But be aware, in case you create a table manually, use "ds_id" as the primary key. Otherwise the plugin won't be able to find your records.
**Warning**: This plugin will automatically create a table, if it doesn't exist yet. But be aware, in case you create a table manually, use "ds_id" as the primary key. Otherwise the plugin won't be able to find your records.

## Configuration Options

```yaml
plugins:
storage:
Expand All @@ -22,48 +24,59 @@ plugins:
database: 'someDb'
defaultTable: 'someTable'
splitChar: '/'
reconnectTimeout: 2000
reconnectCount: 0
```

```javascript
{
//The host that RethinkDb is listening on
host: 'localhost',

//The port that RethinkDb is listening on
port: 28015,

//(Optional) Authentication key for RethinkDb
authKey: 'someString',

//(Optional, defaults to 'deepstream')
database: 'someDb',

//(Optional, defaults to 'deepstream_records')
defaultTable: 'someTable',

/* (Optional) A character that's used as part of the
* record names to split it into a tabel and an id part, e.g.
*
* books/dream-of-the-red-chamber
*
* would create a table called 'books' and store the record under the name
* 'dream-of-the-red-chamber'
*/
splitChar: '/'
//The host that RethinkDb is listening on
host: 'localhost',

//The port that RethinkDb is listening on
port: 28015,

//(Optional) Authentication key for RethinkDb
authKey: 'someString',

//(Optional, defaults to 'deepstream')
database: 'someDb',

//(Optional, defaults to 'deepstream_records')
defaultTable: 'someTable',

/* (Optional) A character that's used as part of the
* record names to split it into a tabel and an id part, e.g.
*
* books/dream-of-the-red-chamber
*
* would create a table called 'books' and store the record under the name
* 'dream-of-the-red-chamber'
*/
splitChar: '/',

// (Optional, defaults to 0) If the rhe rethinkdb connection is lost, try to reconnect max. this number of times
reconnectCount: 2,

// (Optional, defaults to 2000) Timeout between reconnect attempts in milliseconds. It cannot be less than 1000, if you specify less than 1000, then it will be set to 1000!
reconnectTimeout: 3000
}
```

## Basic Setup

```javascript
var Deepstream = require( 'deepstream.io' ),
RethinkDBStorageConnector = require( 'deepstream.io-storage-rethinkdb' ),
server = new Deepstream();
var Deepstream = require('deepstream.io'),
RethinkDBStorageConnector = require('deepstream.io-storage-rethinkdb'),
server = new Deepstream();

server.set( 'storage', new RethinkDBStorageConnector( {
port: 5672,
host: 'localhost'
}));
server.set(
'storage',
new RethinkDBStorageConnector({
port: 5672,
host: 'localhost'
})
);

server.start();
```

Loading