Class: Ledger

Ledger()

An ordered stack of pages.

Constructor

new Ledger()

Properties:
Name Type Description
memory Buffer The ledger's memory (4096 bytes).
stack Stack The ledger's stack.
tip Mixed The most recent page in the ledger.
Source:

Extends

Methods

(async) append(item) → {Promise}

Attempts to append a Page to the ledger.
Parameters:
Name Type Description
item Mixed Item to store.
Source:
Returns:
Resolves after the change has been committed.
Type
Promise

commit()

Increment the vector clock, broadcast all changes as a transaction.
Overrides:
Source:

deserialize(input) → {State}

Take a hex-encoded input and convert to a State object.
Parameters:
Name Type Description
input String [description]
Overrides:
Source:
Returns:
[description]
Type
State

fork() → {State}

Creates a new child State, with `@parent` set to the current State by immutable identifier.
Overrides:
Source:
Returns:
Type
State

get(path) → {Mixed}

Retrieve a key from the State.
Parameters:
Name Type Description
path Path Key to retrieve.
Overrides:
Source:
Returns:
Type
Mixed

inherits(scribe) → {Scribe}

Use an existing Scribe instance as a parent.
Parameters:
Name Type Description
scribe Scribe Instance of Scribe to use as parent.
Overrides:
Source:
Returns:
The configured instance of the Scribe.
Type
Scribe

now() → {Number}

Retrives the current timestamp, in milliseconds.
Overrides:
Source:
Returns:
Number representation of the millisecond Integer value.
Type
Number

render() → {String}

Compose a JSON string for network consumption.
Overrides:
Source:
Returns:
JSON-encoded String.
Type
String

serialize(inputopt) → {Buffer}

Convert to Buffer.
Parameters:
Name Type Attributes Description
input Mixed <optional>
Input to serialize.
Overrides:
Source:
Returns:
Store-able blob.
Type
Buffer

set(path) → {Mixed}

Set a key in the State to a particular value.
Parameters:
Name Type Description
path Path Key to retrieve.
Overrides:
Source:
Returns:
Type
Mixed

toHTML()

Converts the State to an HTML document.
Overrides:
Source:

toString() → {String}

Unmarshall an existing state to an instance of a Blob.
Overrides:
Source:
Returns:
Serialized Blob.
Type
String

trust(source) → {Scribe}

Blindly bind event handlers to the Source.
Parameters:
Name Type Description
source Source Event stream.
Overrides:
Source:
Returns:
Instance of the Scribe.
Type
Scribe