Class: Store

Store(settingsopt) → {Store}

Long-term storage.

Constructor

new Store(settingsopt) → {Store}

Create an instance of a Store to manage long-term storage, which is particularly useful when building a user-facing Product.
Parameters:
Name Type Attributes Default Description
settings Object <optional>
{} configuration object.
Properties:
Name Type Description
settings Mixed Current configuration.
Source:
Returns:
Instance of the Store, ready to start.
Type
Store

Methods

(async) _POST(key, value) → {Promise}

Insert something into a collection.
Parameters:
Name Type Description
key String Path to add data to.
value Mixed Object to store.
Source:
Returns:
Resolves on success with a String pointer.
Type
Promise

(async) _REGISTER(obj) → {Vector}

Registers an Actor. Necessary to store in a collection.
Parameters:
Name Type Description
obj Object Instance of the object to store.
Source:
Returns:
Returned from `storage.set`
Type
Vector

(async) del(key)

Remove a Value by Path.
Parameters:
Name Type Description
key Path Key to remove.
Source:

(async) flush()

Wipes the storage.
Source:

(async) get(key) → {Promise}

Barebones getter.
Parameters:
Name Type Description
key String Name of data to retrieve.
Source:
Returns:
Resolves on complete. `null` if not found.
Type
Promise

(async) set(key, value)

Set a `key` to a specific `value`.
Parameters:
Name Type Description
key String Address of the information.
value Mixed Content to store at `key`.
Source:

(async) start() → {Promise}

Start running the process.
Source:
Returns:
Resolves on complete.
Type
Promise

trust(source) → {Store}

Implicitly trust an Event source.
Parameters:
Name Type Description
source EventEmitter Event-emitting source.
Source:
Returns:
Resulting instance of Store with new trust.
Type
Store