oak-lite

1.0.0 • Public • Published

oak-lite

Build Status codecov npm Dependency Status devDependency Status

Oak-Lite is a lightweight version of Oak, a write-only database with a publish-subscribe model.

Getting Started

Install the oak-lite package into your project with npm.

npm install oak-lite --save

Use the oak-lite module in your project.

import Oak from 'oak-lite';
 
// Configure the database (see the configuration options)
let database = Oak.configure({
    dataDirectory: '/var/lib/myapp/oak'
});
 
// Select the 'counter' rack
let rack = database.selectRack('counter');
 
// Subscribe to the rack
let subscription = rack.subscribe(barrel => {
    // Print each barrel to the console
    console.log(barrel);
});
 
// Publish 3 barrels to the rack
rack.publish(1);
rack.publish(2);
rack.publish(3);
 
// Unsubscribe from the rack after 10 seconds
setTimeout(() => {
    subscription.unsubscribe();
}, 10 * 1000);

Configuration

The following parameters can be defined when configuring an Oak-Lite database:

Parameter Description Required Default
dataDirectory The directory used by this database to store racks Yes none

API

The public interface for oak-lite is defined in the API Guide.

Contributing

Pull requests are welcome! To get started, see the Contributing Guide.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

Package Sidebar

Install

npm i oak-lite

Weekly Downloads

3

Version

1.0.0

License

none

Last publish

Collaborators

  • trevinhofmann