@Override public void readMarshallable(@NotNull WireIn wire) throws IORuntimeException { ValueIn valueIn = wire.getValueIn(); for (int i = 0; i < NUMBER_OF_LONGS; i++) assertEquals(i, valueIn.int64()); //Jvm.pause(PAUSE_READ_MS); }
/** * used by {@link Demarshallable} * * @param wire a wire */ @UsedViaReflection private SCQRoll(@NotNull WireIn wire) { length = wire.read(RollFields.length).int32(); format = wire.read(RollFields.format).text(); epoch = wire.read(RollFields.epoch).int64(); ValueIn rollTimeVIN = wire.read(RollFields.rollTime); if (rollTimeVIN.hasNext()) rollTime = rollTimeVIN.time(); String zoneId = wire.read(RollFields.rollTimeZone).text(); if (zoneId != null) rollTimeZone = ZoneId.of(zoneId); else rollTimeZone = null; }
private long action(@NotNull final ExcerptTailer tailer1, @NotNull final RollCycle rollCycle) { // tailer1.direction(direction); long readvalue = 0; long seqNumRead = 0; try (final DocumentContext dc = tailer1.readingDocument()) { readvalue = dc.wire().read("value").int64(); seqNumRead = dc.index(); } final long nextSeq = rollCycle.toSequenceNumber(tailer1.index()); /*System.out.println("Return-value=" + readvalue + ", seq=" + rollCycle.toSequenceNumber(seqNumRead) + ", next-seq=" + nextSeq + "(" + Long.toHexString(nextSeq) + "x0)" + ",direction=" + tailer1.direction());*/ return readvalue; }
private LongValue loadWritePosition(@NotNull WireIn wire) { final ValueIn read = wire.read(MetaDataField.writePosition); final int code; final long start = wire.bytes().readPosition(); try { wire.consumePadding(); code = wire.bytes().uncheckedReadUnsignedByte(); } finally { wire.bytes().readPosition(start); } if (code == BinaryWireCode.I64_ARRAY) { TwoLongValue result = wire.newTwoLongReference(); // when the write position is and array it also encodes the sequence number in the write position as the second long value read.int128(result); return result; } final LongValue result = wire.newLongReference(); read.int64(result); return result; }
private void readDocument(@NotNull ThreadLocal<ExcerptTailer> tlt, String text) { try (DocumentContext dc = tlt.get().readingDocument()) { if (!dc.isPresent()) return; Assert.assertEquals(dc.index(), dc.wire().read(() -> "key").int64()); Assert.assertEquals(text, dc.wire().read(() -> "text").text()); } }
Assert.assertEquals(last + 1, last = dc.wire().read().int64()); count++; counter.incrementAndGet();
final long documentAcquireTimestamp = valueIn.int64(); if (documentAcquireTimestamp == 0L) { throw new AssertionError("No timestamp");
@Test public void testSomeMessages() { try (ChronicleQueue chronicle = builder(getTmpDir(), wireType) .rollCycle(TEST2_DAILY) .build()) { ExcerptAppender appender = chronicle.acquireAppender(); ExcerptTailer tailer = chronicle.createTailer(); int entries = chronicle.rollCycle().defaultIndexSpacing() * 2 + 2; for (long i = 0; i < entries; i++) { long finalI = i; appender.writeDocument(w -> w.writeEventName("hello").int64(finalI)); long seq = chronicle.rollCycle().toSequenceNumber(appender.lastIndexAppended()); assertEquals(i, seq); // System.out.println(chronicle.dump()); tailer.readDocument(w -> w.read().int64(finalI, (a, b) -> Assert.assertEquals((long) a, b))); } } }
@Override protected void readMarshallableFields(@NotNull WireIn wireIn) { super.readMarshallableFields(wireIn); tierModIterBitSetSizeInBits = wireIn.read(() -> "tierModIterBitSetSizeInBits").int64(); tierModIterBitSetOuterSize = wireIn.read(() -> "tierModIterBitSetOuterSize").int64(); segmentModIterBitSetsForIdentifierOuterSize = wireIn.read(() -> "segmentModIterBitSetsForIdentifierOuterSize").int64(); tierBulkModIterBitSetsForIdentifierOuterSize = wireIn.read(() -> "tierBulkModIterBitSetsForIdentifierOuterSize").int64(); }
private void readTid(@NotNull WireIn metaDataWire) { @NotNull ValueIn valueIn = metaDataWire.readEventName(eventName); if (CoreFields.tid.contentEquals(eventName)) { tid = valueIn.int64(); eventName.setLength(0); } else { tid = -1; } }
@UsedViaReflection public HeartbeatHandler(@NotNull WireIn w) { heartbeatTimeoutMs = w.read(() -> "heartbeatTimeoutMs").int64(); heartbeatIntervalMs = w.read(() -> "heartbeatIntervalMs").int64(); assert heartbeatTimeoutMs >= 1000 : "heartbeatTimeoutMs=" + heartbeatTimeoutMs + ", this is too small"; assert heartbeatIntervalMs >= 500 : "heartbeatIntervalMs=" + heartbeatIntervalMs + ", this is too small"; onMessageReceived(); }
@Override default void readMarshallable(@NotNull WireIn wire) throws IllegalStateException { setNextBootstrapTimestamp(wire.read(() -> "nextBootstrapTimestamp").int64()); setLastBootstrapTimestamp(wire.read(() -> "lastBootstrapTimestamp").int64()); setLastModificationTime(wire.read(() -> "lastModificationTime").int64()); }
@Override public void readMarshallable(@NotNull final WireIn wire) throws IllegalStateException { identifier = wire.read(() -> "id").int8(); lastUpdatedTime = wire.read(() -> "lastUpdatedTime").int64(); } }
@Override default void readMarshallable(@NotNull WireIn wire) throws IllegalStateException { setDeleted(wire.read(() -> "deleted").bool()); setTimestamp(wire.read(() -> "timestamp").int64()); setIdentifier(wire.read(() -> "identifier").int8()); for (int i = 0; i < DIRTY_WORD_COUNT; i++) { final int finalI = i; setDirtyWordAt(i, wire.read(() -> "dirtyWord-" + finalI).int64()); } }
@UsedViaReflection private MapReplicationHandler(@NotNull WireIn wire) { timestamp = wire.read(() -> "timestamp").int64(); keyType = wire.read(() -> "keyType").typeLiteral(); valueType = wire.read(() -> "valueType").typeLiteral(); }
@Override public void readMarshallable(@NotNull WireIn wire) { wire.read(() -> "key").bytesSet((PointerBytesStore) key); wire.read(() -> "value").bytesSet((PointerBytesStore) value); timestamp(wire.read(() -> "timestamp").int64()); identifier(wire.read(() -> "identifier").int8()); isDeleted(wire.read(() -> "isDeleted").bool()); bootStrapTimeStamp(wire.read(() -> "bootStrapTimeStamp").int64()); }
@Override default void readMarshallable(@NotNull final WireIn wire) throws IllegalStateException { key(wire.read(() -> "key").bytesStore()); value(wire.read(() -> "value").bytesStore()); timestamp(wire.read(() -> "timestamp").int64()); identifier(wire.read(() -> "identifier").int8()); isDeleted(wire.read(() -> "isDeleted").bool()); bootStrapTimeStamp(wire.read(() -> "bootStrapTimeStamp").int64()); }
@Override public void readMarshallable(@NotNull WireIn wire) throws IllegalStateException { wire.read(() -> "spec").text(this, (o, s) -> o.spec = s) .read(() -> "name").text(this, (o, s) -> o.name = s) .read(() -> "cluster").text(this, (o, s) -> o.cluster = s) .read(() -> "maxEntries").int64(this, (o, e) -> o.maxEntries = e) .read(() -> "averageValueSize").int32(this, (o, e) -> o.averageValueSize = e) .read(() -> "putReturnsNull").bool(this, (o, b) -> o.putReturnsNull = b) .read(() -> "removeReturnsNull").bool(this, (o, b) -> o.removeReturnsNull = b); }
@Override public void readMarshallable(@NotNull WireIn wire) throws IllegalStateException { wire.read(() -> "diskPath").text(this, (o, c) -> o.diskPath = c) .read(() -> "keyType").typeLiteral(this, (o, c) -> o.keyType = c) .read(() -> "valueType").typeLiteral(this, (o, c) -> o.valueType = c) .read(() -> "compression").text(this, (o, c) -> o.compression = c) .read(() -> "putReturnsNull").bool(this, (o, e) -> o.putReturnsNull = e) .read(() -> "removeReturnsNull").bool(this, (o, e) -> o.removeReturnsNull = e) .read(() -> "entries").int64(this, (o, e) -> o.entries = e) .read(() -> "averageSize").float64(this, (o, e) -> o.averageSize = e); }