public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
bloom.add(out.getHash()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try {
bloom.add(out.getHash()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try {
bloom.add(out.getHash()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try {
bloom.add(out.getHash()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try {
public void reloadCache(DB db) { // LevelDB is great at scanning consecutive keys. // This take seconds even with 20m keys to add. log.info("Loading Bloom Filter"); DBIterator iterator = db.iterator(); byte[] key = getKey(KeyType.OPENOUT_ALL); for (iterator.seek(key); iterator.hasNext(); iterator.next()) { ByteBuffer bbKey = ByteBuffer.wrap(iterator.peekNext().getKey()); byte firstByte = bbKey.get(); // remove the KeyType.OPENOUT_ALL // byte. if (key[0] != firstByte) { printStat(); return; } byte[] hash = new byte[32]; bbKey.get(hash); add(hash); } try { iterator.close(); } catch (IOException e) { log.error("Error closing iterator", e); } printStat(); }
public void add(Sha256Hash hash) { add(hash.getBytes()); }
public void add(Sha256Hash hash) { add(hash.getBytes()); }
public void add(Sha256Hash hash) { add(hash.getBytes()); }
public void add(Sha256Hash hash) { add(hash.getBytes()); }