Class: FileBatch

blockstore.FileBatch(blocks)

Batch operations for fileblockstore. Currently, this is not meant for atomicity or performance improvements, but to have better interface for chaindb. Proper implementation could use single batch for leveldb updates after all file writes.

Constructor

new FileBatch(blocks)

Create AbstractBatch.

Parameters:
Name Type Description
blocks FileBlockStore
Source:

Methods

clear() → {this}

Clear the batch.

Source:
Returns:
Type
this

(async) commit() → {Promise}

Commit both.

Source:
Returns:
Type
Promise

(async) commitPrunes() → {Promise}

Commit only prunes.

Source:
Returns:
Type
Promise

(async) commitWrites() → {Promise}

Commit only writes.

Source:
Returns:
Type
Promise

pruneBlock(hash) → {this}

Prune block data from the batch.

Parameters:
Name Type Description
hash Buffer
Source:
Returns:
Type
this

pruneMerkle(hash) → {this}

Remove merkle block data from the batch.

Parameters:
Name Type Description
hash Buffer
Source:
Returns:
Type
this

pruneUndo(hash) → {this}

Remove undo data from the batch.

Parameters:
Name Type Description
hash Buffer
Source:
Returns:
Type
this

writeBlock(hash, data) → {this}

Write block data to the batch.

Parameters:
Name Type Description
hash Buffer
data Buffer
Source:
Returns:
Type
this

writeMerkle(hash, data) → {this}

Write merkle block data to the batch.

Parameters:
Name Type Description
hash Buffer
data Buffer
Source:
Returns:
Type
this

writeUndo(hash, data) → {this}

Write undo coin data to the batch.

Parameters:
Name Type Description
hash Buffer
data Buffer
Source:
Returns:
Type
this