fcoin/lib/blockstore/layout.js
2019-04-08 13:18:53 -07:00

31 lines
613 B
JavaScript

/*!
* blockstore/layout.js - file block store data layout for bcoin
* Copyright (c) 2019, Braydon Fuller (MIT License).
* https://github.com/bcoin-org/bcoin
*/
'use strict';
const bdb = require('bdb');
/*
* Database Layout:
* V -> db version
* B[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
*/
const layout = {
V: bdb.key('V'),
F: bdb.key('F', ['uint32']),
f: bdb.key('f', ['uint32', 'uint32']),
b: bdb.key('b', ['uint32', 'hash256'])
};
/*
* Expose
*/
module.exports = layout;