@wireapp/store-engine
Provides a storage wrapper API to unify access to different storage technologies.
Last updated 6 hours ago by wireapp-member .
GPL-3.0 · Repository · Original npm · Tarball · package.json
$ cnpm install @wireapp/store-engine 
SYNC missed versions from official npm registry.

Wire

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting opensource@wire.com.

You can find the published source code at github.com/wireapp.

For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.

Store Engine

This package provides an interface to operate with various storage technologies in a uniform manner. There is a MemoryEngine which serves as an example.

Additional storage engines can be found in separate packages such as:

Motivation

Nowadays there are more and more storage possibilities and developers must be familiar with the characteristics of each individual solution to reliably store data. Because it can be sometimes hard to keep up with the highly dynamic world of data storages, we have developed a system which unifies the use of different storages / databases.

Quickstart

Engine instantiation

const {MemoryEngine} = require('@wireapp/store-engine');
const engine = new MemoryEngine('my-database');

Transient store

As a bonus to the store engine, we built a transient store which deletes data after a specified TTL:

const {Store, MemoryEngine} = require('@wireapp/store-engine');

const engine = new MemoryEngine('my-favorite-actors');
const store = new Store.TransientStore(engine);

const ttl = 1000;

store
  .init('the-simpsons')
  .then(() => store.set('bart', {name: 'Bart Simpson'}, ttl))
  .then(transientBundle => {
    console.log(`The record of "${transientBundle.payload.name}" will expires in "${transientBundle.expires}"ms.`);
  });

API

No matter which engine you use, they all support common CRUD operations.

Example

The following API calls we use this data:

const TABLE_NAME = 'the-simpsons';
const PRIMARY_KEY = 'lisa-simpson';
const ENTITY = {name: 'Lisa Simpson'};

create

engine.create(TABLE_NAME, PRIMARY_KEY, ENTITY).then(primaryKey => {
  console.log(`Saved record with primary key "${primaryKey}".`);
});

delete

engine.delete(TABLE_NAME, PRIMARY_KEY).then(primaryKey => {
  console.log(`Deleted record with primary key "${primaryKey}".`);
});

deleteAll

engine.deleteAll(TABLE_NAME).then(wasDeleted => {
  if (wasDeleted) {
    console.log('The Simpsons have been deleted. Poor Simpsons!');
  }
});

purge

engine.purge().then(() => {
  console.log('The Simpson Universe has been deleted. Doh!');
});

read

engine.read(TABLE_NAME, PRIMARY_KEY).then(record => {
  console.log(`Her name is "${record.name}".`);
});

readAll

engine.readAll(TABLE_NAME).then(records => {
  console.log(`There are "${record.length}" Simpsons in our database.`);
});

readAllPrimaryKeys

engine.readAllPrimaryKeys(TABLE_NAME).then(primaryKeys => {
  console.log(`Identifiers of our Simpsons: "${primaryKeys.join(', ')}"`);
});

update

engine.update(TABLE_NAME, PRIMARY_KEY, {brother: 'Bart Simpson'}).then((primaryKey) => {
  return engine.read(TABLE_NAME, PRIMARY_KEY);
}).then((updatedRecord) => {
  console.log(`The brother of "${updatedRecord.name}" is "${updatedRecord.brother}".`):
})

Current Tags

  • 3.5.4                                ...           latest (6 hours ago)

257 Versions

  • 3.5.4                                ...           6 hours ago
  • 3.5.3                                ...           3 days ago
  • 3.5.2                                ...           8 days ago
  • 3.5.1                                ...           14 days ago
  • 3.5.0                                ...           15 days ago
  • 3.4.0                                ...           16 days ago
  • 3.3.1                                ...           16 days ago
  • 3.3.0                                ...           22 days ago
  • 3.2.0                                ...           23 days ago
  • 3.1.1                                ...           24 days ago
  • 3.1.0                                ...           a month ago
  • 3.0.14                                ...           a month ago
  • 3.0.13                                ...           a month ago
  • 3.0.12                                ...           a month ago
  • 3.0.11                                ...           a month ago
  • 3.0.10                                ...           a month ago
  • 3.0.9                                ...           a month ago
  • 3.0.8                                ...           a month ago
  • 3.0.7                                ...           a month ago
  • 3.0.6                                ...           a month ago
  • 3.0.5                                ...           a month ago
  • 3.0.4                                ...           a month ago
  • 3.0.3                                ...           a month ago
  • 3.0.2                                ...           2 months ago
  • 3.0.1                                ...           2 months ago
  • 3.0.0                                ...           2 months ago
  • 2.1.4                                ...           2 months ago
  • 2.1.3                                ...           2 months ago
  • 2.1.2                                ...           2 months ago
  • 2.1.1                                ...           2 months ago
  • 2.1.0                                ...           2 months ago
  • 2.0.0                                ...           3 months ago
  • 1.1.47                                ...           3 months ago
  • 1.1.46                                ...           3 months ago
  • 1.1.45                                ...           3 months ago
  • 1.1.44                                ...           3 months ago
  • 1.1.43                                ...           3 months ago
  • 1.1.42                                ...           4 months ago
  • 1.1.41                                ...           4 months ago
  • 1.1.40                                ...           4 months ago
  • 1.1.39                                ...           4 months ago
  • 1.1.38                                ...           4 months ago
  • 1.1.37                                ...           4 months ago
  • 1.1.36                                ...           4 months ago
  • 1.1.35                                ...           4 months ago
  • 1.1.34                                ...           4 months ago
  • 1.1.33                                ...           4 months ago
  • 1.1.32                                ...           4 months ago
  • 1.1.31                                ...           4 months ago
  • 1.1.30                                ...           4 months ago
  • 1.1.29                                ...           4 months ago
  • 1.1.28                                ...           4 months ago
  • 1.1.27                                ...           4 months ago
  • 1.1.26                                ...           5 months ago
  • 1.1.25                                ...           5 months ago
  • 1.1.24                                ...           5 months ago
  • 1.1.23                                ...           5 months ago
  • 1.1.22                                ...           5 months ago
  • 1.1.21                                ...           5 months ago
  • 1.1.20                                ...           6 months ago
  • 1.1.19                                ...           6 months ago
  • 1.1.18                                ...           6 months ago
  • 1.1.17                                ...           6 months ago
  • 1.1.16                                ...           7 months ago
  • 1.1.15                                ...           7 months ago
  • 1.1.14                                ...           7 months ago
  • 1.1.13                                ...           7 months ago
  • 1.1.12                                ...           7 months ago
  • 1.1.11                                ...           7 months ago
  • 1.1.10                                ...           7 months ago
  • 1.1.9                                ...           8 months ago
  • 1.1.8                                ...           8 months ago
  • 1.1.7                                ...           8 months ago
  • 1.1.6                                ...           8 months ago
  • 1.1.5                                ...           8 months ago
  • 1.1.4                                ...           8 months ago
  • 1.1.3                                ...           8 months ago
  • 1.1.2                                ...           8 months ago
  • 1.1.1                                ...           8 months ago
  • 1.1.0                                ...           8 months ago
  • 1.0.19                                ...           8 months ago
  • 1.0.18                                ...           8 months ago
  • 1.0.17                                ...           8 months ago
  • 1.0.16                                ...           8 months ago
  • 1.0.15                                ...           8 months ago
  • 1.0.14                                ...           8 months ago
  • 1.0.13                                ...           8 months ago
  • 1.0.12                                ...           8 months ago
  • 1.0.11                                ...           8 months ago
  • 1.0.10                                ...           8 months ago
  • 1.0.9                                ...           9 months ago
  • 1.0.8                                ...           9 months ago
  • 1.0.7                                ...           9 months ago
  • 1.0.6                                ...           9 months ago
  • 1.0.5                                ...           9 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
  • 0.12.26                                ...           9 months ago
  • 0.12.25                                ...           9 months ago
  • 0.12.24                                ...           9 months ago
  • 0.12.23                                ...           10 months ago
  • 0.12.22                                ...           10 months ago
  • 0.12.21                                ...           10 months ago
  • 0.12.20                                ...           10 months ago
  • 0.12.19                                ...           10 months ago
  • 0.12.18                                ...           10 months ago
  • 0.12.17                                ...           10 months ago
  • 0.12.16                                ...           10 months ago
  • 0.12.15                                ...           10 months ago
  • 0.12.14                                ...           10 months ago
  • 0.12.13                                ...           10 months ago
  • 0.12.12                                ...           10 months ago
  • 0.12.11                                ...           10 months ago
  • 0.12.10                                ...           a year ago
  • 0.12.9                                ...           a year ago
  • 0.12.8                                ...           a year ago
  • 0.12.7                                ...           a year ago
  • 0.12.6                                ...           a year ago
  • 0.12.5                                ...           a year ago
  • 0.12.4                                ...           a year ago
  • 0.12.0                                ...           a year ago
  • 0.11.56                                ...           a year ago
  • 0.11.55                                ...           a year ago
  • 0.11.53                                ...           a year ago
  • 0.11.52                                ...           a year ago
  • 0.11.51                                ...           a year ago
  • 0.11.50                                ...           a year ago
  • 0.11.49                                ...           a year ago
  • 0.11.48                                ...           a year ago
  • 0.11.47                                ...           a year ago
  • 0.11.46                                ...           a year ago
  • 0.11.45                                ...           a year ago
  • 0.11.44                                ...           a year ago
  • 0.11.43                                ...           a year ago
  • 0.11.42                                ...           a year ago
  • 0.11.41                                ...           a year ago
  • 0.11.40                                ...           a year ago
  • 0.11.39                                ...           a year ago
  • 0.11.38                                ...           a year ago
  • 0.11.37                                ...           a year ago
  • 0.11.36                                ...           a year ago
  • 0.11.35                                ...           a year ago
  • 0.11.34                                ...           a year ago
  • 0.11.33                                ...           a year ago
  • 0.11.32                                ...           a year ago
  • 0.11.31                                ...           a year ago
  • 0.11.30                                ...           a year ago
  • 0.11.29                                ...           a year ago
  • 0.11.28                                ...           a year ago
  • 0.11.27                                ...           a year ago
  • 0.11.26                                ...           a year ago
  • 0.11.25                                ...           a year ago
  • 0.11.24                                ...           a year ago
  • 0.11.23                                ...           a year ago
  • 0.11.22                                ...           a year ago
  • 0.11.21                                ...           a year ago
  • 0.11.20                                ...           a year ago
  • 0.11.19                                ...           a year ago
  • 0.11.18                                ...           a year ago
  • 0.11.17                                ...           a year ago
  • 0.11.16                                ...           a year ago
  • 0.11.15                                ...           a year ago
  • 0.11.14                                ...           a year ago
  • 0.11.13                                ...           a year ago
  • 0.11.12                                ...           a year ago
  • 0.11.11                                ...           a year ago
  • 0.11.10                                ...           a year ago
  • 0.11.9                                ...           a year ago
  • 0.11.8                                ...           a year ago
  • 0.11.7                                ...           a year ago
  • 0.11.6                                ...           a year ago
  • 0.11.5                                ...           a year ago
  • 0.11.4                                ...           a year ago
  • 0.11.3                                ...           a year ago
  • 0.11.2                                ...           a year ago
  • 0.11.1                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.2                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.0                                ...           a year ago
  • 0.7.1                                ...           a year ago
  • 0.7.0                                ...           a year ago
  • 0.6.3                                ...           a year ago
  • 0.6.2                                ...           a year ago
  • 0.6.1                                ...           a year ago
  • 0.6.0                                ...           a year ago
  • 0.5.12                                ...           a year ago
  • 0.5.11                                ...           a year ago
  • 0.5.10                                ...           a year ago
  • 0.5.9                                ...           a year ago
  • 0.5.8                                ...           a year ago
  • 0.5.7                                ...           a year ago
  • 0.5.6                                ...           a year ago
  • 0.5.5                                ...           a year ago
  • 0.5.4                                ...           a year ago
  • 0.5.3                                ...           a year ago
  • 0.5.2                                ...           a year ago
  • 0.5.1                                ...           a year ago
  • 0.5.0                                ...           a year ago
  • 0.4.2                                ...           a year ago
  • 0.4.1                                ...           a year ago
  • 0.3.9                                ...           a year ago
  • 0.3.8                                ...           a year ago
  • 0.3.7                                ...           a year ago
  • 0.3.6                                ...           a year ago
  • 0.3.5                                ...           a year ago
  • 0.3.4                                ...           a year ago
  • 0.3.3                                ...           a year ago
  • 0.3.2                                ...           a year ago
  • 0.3.1                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.5                                ...           a year ago
  • 0.2.4                                ...           a year ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.15                                ...           a year ago
  • 0.1.14                                ...           a year ago
  • 0.1.13                                ...           a year ago
  • 0.1.12                                ...           a year ago
  • 0.1.11                                ...           a year ago
  • 0.1.10                                ...           a year ago
  • 0.1.9                                ...           a year ago
  • 0.1.8                                ...           2 years ago
  • 0.1.6                                ...           2 years ago
  • 0.1.5                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
  • 0.0.22                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.19                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.16                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |