lib/btreedb.js
function Index(keySize, block) {
  var reader = new SbonReader(block.buffer);

  this.level = reader.readUint8();

  // Number of keys in this index.
  this.keyCount = reader.readInt32();

  // The blocks that the keys point to. There will be one extra block in the
  // beginning of this list that points to the block to go to if the key being
  // searched for is left of the first key in this index.
  this.blockIds = new Int32Array(this.keyCount + 1);
  this.blockIds[0] = reader.readInt32();

  this.keys = [];

  // Load all key/block reference pairs.
  for (var i = 1; i <= this.keyCount; i++) {
    this.keys.push(reader.readByteString(keySize));
    this.blockIds[i] = reader.readInt32();
  }
}
function Index(keySize, block) {
  var reader = new SbonReader(block.buffer);

  this.level = reader.readUint8();

  // Number of keys in this index.
  this.keyCount = reader.readInt32();

  // The blocks that the keys point to. There will be one extra block in the
  // beginning of this list that points to the block to go to if the key being
  // searched for is left of the first key in this index.
  this.blockIds = new Int32Array(this.keyCount + 1);
  this.blockIds[0] = reader.readInt32();

  this.keys = [];

  // Load all key/block reference pairs.
  for (var i = 1; i <= this.keyCount; i++) {
    this.keys.push(reader.readByteString(keySize));
    this.blockIds[i] = reader.readInt32();
  }
}
function Index ( keySize , block ) { var reader = new SbonReader ( block . buffer ) ; this . level = reader . readUint8 ( ) ; // Number of keys in this index. this . keyCount = reader . readInt32 ( ) ; // The blocks that the keys point to. There will be one extra block in the // beginning of this list that points to the block to go to if the key being // searched for is left of the first key in this index. this . blockIds = new Int32Array ( this . keyCount + 1 ) ; this . blockIds [ 0 ] = reader . readInt32 ( ) ; this . keys = [ ] ; // Load all key/block reference pairs. for ( var i = 1 ; i <= this . keyCount ; i ++ ) { this . keys . push ( reader . readByteString ( keySize ) ) ; this . blockIds [ i ] = reader . readInt32 ( ) ; } }
Wraps a block object to provide functionality for parsing and scanning an
index.
Wraps a block object to provide functionality for parsing and scanning an index .