public boolean nextIndex() { return excerpt.nextIndex(); }
/** * Should only be used for plain IndexChronicle. * * @return was a new entry found. */ public boolean nextEvent() { assert updater == null; assert excerpt != null; if (excerpt.nextIndex()) { processNextEvent(false); return true; } return false; } }
public boolean read() { if (!excerpt.nextIndex()) return false; MessageType mt = excerpt.readEnum(MessageType.class); metaData.readMarshallable(excerpt); switch (mt) { case update: { update.readMarshallable(excerpt); events.onMarketData(metaData, update); break; } } return true; } }
@Override public void run() { excerpt = chronicle.createExcerpt(); while (!closed) { boolean found = excerpt.nextIndex(); if (found) { processNextEvent(excerpt.index() <= lastEvent); } else { for (Wrapper wrapper : wrappersArray) { wrapper.notifyOff(false); wrapper.inSync(); } } } } });
public boolean readOne() { if (!excerpt.nextIndex()) return false; int pos = excerpt.position(); MessageType mt = excerpt.readEnum(MessageType.class); if (mt == null) { // rewind and read again. excerpt.position(pos); System.err.println("Unknown message type " + excerpt.readUTF()); return true; } switch (mt) { case report: { metaData.readFromEngine(excerpt, sourceId); report.readMarshallable(excerpt); gwEvents.report(metaData, report); break; } default: System.err.println("Unknown message type " + mt); break; } return true; } }
public boolean readOne() { if (!excerpt.nextIndex()) return false; int pos = excerpt.position(); MessageType mt = excerpt.readEnum(MessageType.class); if (mt == null) { // rewind and read again. excerpt.position(pos); System.err.println("Unknown message type " + excerpt.readUTF()); return true; } switch (mt) { case small: { metaData.sourceId = sourceId; metaData.readFromGateway(excerpt); smallCommand.readMarshallable(excerpt); peEvents.small(metaData, smallCommand); break; } default: System.err.println("Unknown message type " + mt); break; } return true; } }
assertEquals("i: " + i, sb.toString(), text); assertTrue(excerpt.nextIndex()); String text = excerpt.readUTF(); excerpt.finish();
public boolean readEntry() { if (!excerpt.nextIndex()) return false; long writeTimeMS = excerpt.readLong(); long writeTimeNS = excerpt.readLong(); int pos = excerpt.position(); long readTimeNS = excerpt.readLong(); if (targetReader && readTimeNS == 0) excerpt.writeLong(pos, readTimeNS = System.nanoTime()); int length = excerpt.readInt24(); char type = (char) excerpt.readUnsignedByte(); onEntry(writeTimeMS, writeTimeNS, readTimeNS, length, type, excerpt); return true; }
excerpt = chronicle.createExcerpt(); long size = excerpt.size(); while (excerpt.index() < size && excerpt.nextIndex()) { processNextEvent(excerpt.index() <= lastEvent);
int count = 0; final Excerpt excerpt2 = chronicle.createExcerpt(); while (excerpt2.nextIndex()) { final long timestamp = excerpt2.readLong(); long time = System.nanoTime() - timestamp;
while (excerpt.nextIndex()) { long l = excerpt.parseLong(); assert l == 8;
public boolean nextIndex() { return excerpt.nextIndex(); }
/** * Should only be used for plain IndexChronicle. * * @return was a new entry found. */ public boolean nextEvent() { assert updater == null; assert excerpt != null; if (excerpt.nextIndex()) { processNextEvent(false); return true; } return false; } }
public boolean readEntry() { if (!excerpt.nextIndex()) return false; long writeTimeMS = excerpt.readLong(); long writeTimeNS = excerpt.readLong(); int pos = excerpt.position(); long readTimeNS = excerpt.readLong(); if (targetReader && readTimeNS == 0) excerpt.writeLong(pos, readTimeNS = System.nanoTime()); int length = excerpt.readInt24(); char type = (char) excerpt.readUnsignedByte(); onEntry(writeTimeMS, writeTimeNS, readTimeNS, length, type, excerpt); return true; }
@Override public void run() { excerpt = chronicle.createExcerpt(); while (!closed) { boolean found = excerpt.nextIndex(); if (found) { processNextEvent(excerpt.index() <= lastEvent); } else { for (Wrapper wrapper : wrappersArray) { wrapper.notifyOff(false); wrapper.inSync(); } } } } });
@Override public void nextTuple() { if (excerpt.nextIndex()) { int userId = excerpt.readInt(); int channelId = excerpt.readInt(); int duration = excerpt.readInt(); if (channelId == 0) { // poison, set countdown LATCH. StartStorm.LATCH.countDown(); } else { collector.emit(new Values(userId, channelId, duration)); } } else { // dont busy spin, not actually required here since we have the // poison object. Utils.sleep(500); } }
excerpt = chronicle.createExcerpt(); long size = excerpt.size(); while (excerpt.index() < size && excerpt.nextIndex()) { processNextEvent(excerpt.index() <= lastEvent);
// create a Chronicle for reading or writing. String basePath = TMP + File.separator + "deleteme.ict"; IndexedChronicle tsc = new IndexedChronicle(basePath); // create a handle to excerpts in the chronicle. Excerpt excerpt = tsc.createExcerpt(); // add 1024 entries. int counter = 1; for (int i = 0; i < 1024; i++) { excerpt.startExcerpt(129); for (int j = 0; j < 128; j += 8) excerpt.writeLong(counter++); excerpt.write(-1); excerpt.finish(); } // somewhere else read the file int counter2 = 1; Excerpt excerpt2 = tsc.createExcerpt(); while (excerpt2.nextIndex()) { for (int j = 0; j < 128; j += 8) { long actual = excerpt2.readLong(); long expected = counter2++; if (expected != actual) assertEquals(expected, actual); } assertEquals(-1, excerpt2.readByte()); excerpt2.finish(); } assertEquals(counter, counter2);