blockstore: minor, update comments and docs

This commit is contained in:
Braydon Fuller 2019-03-07 15:27:21 -08:00
parent 2ba3ee6354
commit d1e747cf2f
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4
8 changed files with 23 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/*!
* bench/blockstore.js - benchmark block store for bcoin
* bench/blockstore.js - benchmark blockstore for bcoin
*
* This can be run to benchmark the performance of the blockstore
* module for writing, reading and pruning block data. Results are
@ -7,14 +7,15 @@
*
* Usage:
* node ./blockstore.js [--maxfile=<bytes>] [--total=<bytes>]
[--location=<path>] [--store=<name>] [--unsafe]
* [--location=<path>] [--store=<name>]
* [--output=<name>] [--unsafe]
*
* Options:
* - `maxfile` The maximum file size (applies to "file" store).
* - `total` The total number of block bytes to write.
* - `location` The location to store block data.
* - `store` This can be "file" or "level".
* - `output` This can be "json" or "bench".
* - `output` This can be "json", "bench" or "benchjson".
* - `unsafe` This will allocate block data directly from memory
* instead of random, it is faster.
*

View File

@ -1667,8 +1667,7 @@ class ChainDB {
if (this.options.spv)
return;
// Write actual block data (this may be
// better suited to flat files in the future).
// Write actual block data.
await this.blocks.write(hash, block.toRaw());
if (!view)

View File

@ -1,5 +1,5 @@
/*!
* blockstore/abstract.js - abstract block store for bcoin
* blockstore/abstract.js - abstract blockstore for bcoin
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/
@ -52,7 +52,7 @@ class AbstractBlockStore {
/**
* This method closes resources and prepares
* store to be closed.
* the store to be closed.
* @returns {Promise}
*/

View File

@ -1,5 +1,5 @@
/*!
* common.js - block store constants for bcoin
* common.js - blockstore constants for bcoin
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/
@ -11,7 +11,7 @@
*/
/**
* Data types.
* Block data types.
* @enum {Number}
*/
@ -21,7 +21,7 @@ exports.types = {
};
/**
* File prefixes for data types.
* File prefixes for block data types.
* @enum {String}
*/

View File

@ -1,5 +1,5 @@
/*!
* blockstore/file.js - file block store for bcoin
* blockstore/file.js - file blockstore for bcoin
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/
@ -157,7 +157,7 @@ class FileBlockStore extends AbstractBlockStore {
/**
* This closes the file block store and underlying
* databases for indexing.
* indexing databases.
*/
async close() {
@ -170,6 +170,7 @@ class FileBlockStore extends AbstractBlockStore {
* This method will determine the file path based on the file number
* and the current block data location.
* @private
* @param {Number} type - The type of block data
* @param {Number} fileno - The number of the file.
* @returns {Promise}
*/
@ -199,9 +200,10 @@ class FileBlockStore extends AbstractBlockStore {
/**
* This method will select and potentially allocate a file to
* write a block based on the size.
* write a block based on the size and type.
* @private
* @param {Number} length - The number of bytes of the data to be written.
* @param {Number} type - The type of block data
* @param {Number} length - The number of bytes
* @returns {Promise}
*/
@ -280,6 +282,7 @@ class FileBlockStore extends AbstractBlockStore {
* data to the last written file and updating indexes to point
* to the file and position.
* @private
* @param {Number} type - The type of block data
* @param {Buffer} hash - The block hash
* @param {Buffer} data - The block data
* @returns {Promise}
@ -372,7 +375,7 @@ class FileBlockStore extends AbstractBlockStore {
* This methods reads data from disk by retrieving the index of
* the data and reading from the correponding file and location.
* @private
* @param {Buffer} type - The data type
* @param {Number} type - The type of block data
* @param {Buffer} hash - The block hash
* @param {Number} offset - The offset within the block
* @param {Number} length - The number of bytes of the data

View File

@ -1,5 +1,5 @@
/*!
* blockstore/layout.js - file block store data layout for bcoin
* blockstore/layout.js - file blockstore data layout for bcoin
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/
@ -11,7 +11,7 @@ const bdb = require('bdb');
/*
* Database Layout:
* V -> db version
* B[type] -> last file record by type
* F[type] -> last file record by type
* f[type][fileno] -> file record by type and file number
* b[type][hash] -> block record by type and block hash
*/

View File

@ -1,5 +1,5 @@
/*!
* blockstore/level.js - leveldb block store for bcoin
* blockstore/level.js - leveldb blockstore for bcoin
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/

View File

@ -1,5 +1,5 @@
/*!
* blockstore/records.js - block store records
* blockstore/records.js - blockstore records
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/
@ -82,7 +82,7 @@ class BlockRecord {
class FileRecord {
/**
* Create a chain state.
* Create a file record.
* @constructor
*/