Class: LevelBlockStore

(abstract) LevelBlockStore()

LevelDB Block Store

Constructor

(abstract) new LevelBlockStore()

Create a blockstore that stores blocks in LevelDB.

Source:

Methods

(async) close()

Closes the block storage.

Source:

(async) ensure() → {Promise}

This method ensures that the storage directory exists before opening.

Source:
Returns:
Type
Promise

(async) has(hash) → {Promise}

This will check if a block has been stored and is available.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) hasFilter(hash) → {Promise}

This will check if a block filter has been stored and is available.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) hasMerkle(hash) → {Promise}

This will check if a merkle block data has been stored and is available.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) hasUndo(hash) → {Promise}

This will check if a block undo coin data has been stored and is available.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) open() → {Promise}

Opens the block storage.

Source:
Returns:
Type
Promise

(async) prune(hash) → {Promise}

This will free resources for storing the block data. The block data may not be immediately removed from disk, and will be reclaimed during LevelDB compaction.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) pruneFilter(hash) → {Promise}

This will free resources for storing the serialized block filter data.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) pruneMerkle(hash) → {Promise}

This will free resources for storing merkle block data. The block data may not be immediately removed from disk, and will be reclaimed during LevelDB compaction.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) pruneUndo(hash) → {Promise}

This will free resources for storing the block undo coin data. The block data may not be immediately removed from disk, and will be reclaimed during LevelDB compaction.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) read(hash, offset, length) → {Promise}

This method will retrieve block data. Smaller portions of the block (e.g. transactions) can be returned using the offset and length arguments. However, the entire block will be read as the data is stored in a key/value database.

Parameters:
Name Type Description
hash Buffer

The block hash

offset Number

The offset within the block

length Number

The number of bytes of the data

Source:
Returns:
Type
Promise

(async) readFilter(hash) → {Promise}

This method will retrieve serialized block filter data.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) readFilterHeader(hash) → {Promise}

This method will retrieve block filter header only.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) readMerkle(hash) → {Promise}

This method will retrieve merkle block data.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) readUndo(hash) → {Promise}

This method will retrieve block undo coin data.

Parameters:
Name Type Description
hash Buffer

The block hash

Source:
Returns:
Type
Promise

(async) write(hash, data) → {Promise}

This method stores block data in LevelDB.

Parameters:
Name Type Description
hash Buffer

The block hash

data Buffer

The block data

Source:
Returns:
Type
Promise

(async) writeFilter(hash, data) → {Promise}

This method stores serialized block filter data in LevelDB.

Parameters:
Name Type Description
hash Buffer

The block hash

data Buffer

The serialized block filter data.

Source:
Returns:
Type
Promise

(async) writeMerkle(hash, data) → {Promise}

This method stores merkle block data in LevelDB.

Parameters:
Name Type Description
hash Buffer

The block hash

data Buffer

The block data

Source:
Returns:
Type
Promise

(async) writeUndo(hash, data) → {Promise}

This method stores block undo coin data in LevelDB.

Parameters:
Name Type Description
hash Buffer

The block hash

data Buffer

The block data

Source:
Returns:
Type
Promise