static boolean checkState(final Journal jrnl, final long state, final String name) { try { IIndex istate = jrnl.getIndex("TestIndex", state); if (istate == null) { System.out.println("No index found for state: " + state); return false; } if(!name.equals(istate.lookup("Name"))) { throw new AssertionError(name + " != " + istate.lookup("Name")); } System.out.println("Index confirmed for state: " + state); return true; } catch (Exception e) { e.printStackTrace(); throw new AssertionError("Unable to load index"); } }
static boolean checkState(final Journal jrnl, final long state, final String name) { try { IIndex istate = jrnl.getIndex("TestIndex", state); if (istate == null) { System.out.println("No index found for state: " + state); return false; } if(!name.equals(istate.lookup("Name"))) { throw new AssertionError(name + " != " + istate.lookup("Name")); } System.out.println("Index confirmed for state: " + state); return true; } catch (Exception e) { e.printStackTrace(); throw new AssertionError("Unable to load index"); } }
eventStore.getIndex("events").writeCheckpoint();
eventStore.getIndex("events").writeCheckpoint();
/** * Add the value to the index, commit, assert value retrieval and * return the commit time */ static long insertName(final Journal jrnl, final String name) { IIndex index = jrnl.getIndex("TestIndex"); index.remove("Name"); index.insert("Name", name); final long ret = jrnl.commit(); if(!name.equals(index.lookup("Name"))) { throw new AssertionError(name + " != " + index.lookup("Name")); } return ret; }
/** * Add the value to the index, commit, assert value retrieval and * return the commit time */ static long insertName(final Journal jrnl, final String name) { IIndex index = jrnl.getIndex("TestIndex"); index.remove("Name"); index.insert("Name", name); final long ret = jrnl.commit(); if(!name.equals(index.lookup("Name"))) { throw new AssertionError(name + " != " + index.lookup("Name")); } return ret; }
@Override public Void call() throws Exception { for (int i = 0; i < NUM_INDICES; i++) { final String name = PREFIX + i; // lookup the index. final BTree ndx = src.getIndex(name); // #of tuples to write. final int ntuples = r.nextInt(10000); // generate random data. final KV[] a = AbstractBTreeTestCase .getRandomKeyValues(ntuples); // write tuples (in random order) for (KV kv : a) { ndx.insert(kv.key, kv.val); if (r.nextInt(100) < 10) { // randomly increment the counter (10% of the time). ndx.getCounter().incrementAndGet(); } } } // Done. return null; }});
@Override public Void call() throws Exception { for (int i = 0; i < NUM_INDICES; i++) { final String name = PREFIX + i; // lookup the index. final BTree ndx = src.getIndex(name); // #of tuples to write. final int ntuples = r.nextInt(10000); // generate random data. final KV[] a = AbstractBTreeTestCase .getRandomKeyValues(ntuples); // write tuples (in random order) for (KV kv : a) { ndx.insert(kv.key, kv.val); if (r.nextInt(100) < 10) { // randomly increment the counter (10% of the time). ndx.getCounter().incrementAndGet(); } } } // Done. return null; }});
@Override public Void call() throws Exception { for (int i = 0; i < NUM_INDICES; i++) { final String name = PREFIX + i; // lookup the index. final BTree ndx = src.getIndex(name); // #of tuples to write. final int ntuples = r.nextInt(10000); // generate random data. final KV[] a = AbstractBTreeTestCase .getRandomKeyValues(ntuples); // write tuples (in random order) for (KV kv : a) { ndx.insert(kv.key, kv.val); if (r.nextInt(100) < 10) { // randomly increment the counter (10% of the time). ndx.getCounter().incrementAndGet(); } } } // Done. return null; }});
@Override public Void call() throws Exception { for (int i = 0; i < NUM_INDICES; i++) { final String name = PREFIX + i; // lookup the index. final BTree ndx = src.getIndex(name); // #of tuples to write. final int ntuples = r.nextInt(10000); // generate random data. final KV[] a = AbstractBTreeTestCase .getRandomKeyValues(ntuples); // write tuples (in random order) for (KV kv : a) { ndx.insert(kv.key, kv.val); if (r.nextInt(100) < 10) { // randomly increment the counter (10% of the time). ndx.getCounter().incrementAndGet(); } } } // Done. return null; }});
CounterSetBTree btree = (CounterSetBTree) store.getIndex("counters");
final BTree ndx = src.getIndex(NAME);
final BTree ndx = src.getIndex(NAME);