Constructor
(abstract) new module:blockstore:LevelBlockStore(optionsopt)
Create a blockstore that stores blocks in LevelDB.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
- Source:
Methods
batch() → {LevelBatch}
Create batch.
- Source:
Returns:
- Type
- LevelBatch
(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) hasBlock(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) 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) pruneBlock(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) 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) readBlock(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) 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) writeBlock(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) 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