Namespace: Log

Log~Log

The instance returned by module:Log

Source:

Methods

(async) append(data, options) → {module:Log~Entry}

Append an new entry to the log

Parameters:
Name Type Description
data data

Payload to add to the entry

options Object
Properties
Name Type Description
referencesCount number

TODO

Source:
Returns:

Entry that was appended

Type
module:Log~Entry

(async) clear()

Clear all entries from the log and the underlying storages

Source:

(async) clock() → {module:Clock}

Returns the clock of the log.

Source:
Returns:
Type
module:Clock

(async) close()

Close the log and underlying storages

Source:

(async) get(hash) → {module:Log~Entry}

Retrieve an entry

Parameters:
Name Type Description
hash string

The hash of the entry to retrieve

Source:
Returns:
Type
module:Log~Entry

(async) heads() → {Array.<module:Log~Entry>}

Returns the current heads of the log

Source:
Returns:
Type
Array.<module:Log~Entry>

isLog(obj) → {boolean}

Check if an object is a Log.

Parameters:
Name Type Description
obj Log
Source:
Returns:
Type
boolean

(async, generator) iterator(options) → {Symbol.asyncIterator}

Async iterator over the log entries

Parameters:
Name Type Description
options Object
Properties
Name Type Description
amount amount

Number of entried to return. Default: return all entries.

gt string

Beginning hash of the iterator, non-inclusive

gte string

Beginning hash of the iterator, inclusive

lt string

Ending hash of the iterator, non-inclusive

lte string

Ending hash of the iterator, inclusive

Source:
Returns:

Iterator object of log entries

Type
Symbol.asyncIterator

(async) join(log)

Join two logs.

Joins another log into this one.

Parameters:
Name Type Description
log module:Log~Log

Log to join with this Log

Source:
Example
await log1.join(log2)

(async) joinEntry(entry)

Join an entry into a log.

Parameters:
Name Type Description
entry module:Log~Entry

Entry to join with this Log

Source:
Example
await log.joinEntry(entry)

(async, generator) traverse()

TODO

Source:

(async) values() → {Array.<module:Log~Entry>}

Returns all entries in the log

Source:
Returns:
Type
Array.<module:Log~Entry>