1.0.15 • Published 7 years ago

level-airplanedb v1.0.15

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

level-airplanedb

This module allows you to work offline in the browser using indexdb (+ shim for websql when indexdb not available).

You get a sync method in browserified client to write to the server. The server gets a sync method that returns a readstream of the changelog after the given timestamp.

js-standard-style

build status

Sauce Test Status

Example client

var levelup = require('levelup');
var leveljs = require('level-js');
var airplanedb = require('level-airplanedb');

var db = levelup('test', {db: leveljs});

db = airplanedb(db);

// sync range
// any keys in local changelog will be written to the server
// any keys from remotedb will be synced to client
db.sync({start: ..., end: ...}, remotedb, cb);

// changes to local db will be written to changelog removed when synced.

Example server

var levelup = require('levelup');
var leveldown = require('leveldown');
var airplanedb = require('level-airplanedb');

var db = levelup('test', {db: leveldown});

db = airplanedb(db);

db.sync(from, range) // readstream of changelog >= from

Background

In the spirit of offline first I wanted a working offline storage, giving me the choice when to sync saving battery usage.

level-sublevel is used to persist the changelog both on client and server.

See test/simple.js for a client server example using :-

multilevel - leveldb over network

level-js - leveldown api in the browser

Gotchas

This is a work in progress, conflicts are not handled at all! The client's changelog is what is written to the server.

Updating keys in the same range as a running sync is not supported, doing this will incur loss of data.

install

With npm do:

npm install level-airplanedb

test

npm test

license

MIT

1.0.15

7 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.15

9 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago