@NotNull private Wire readAnywhere(@NotNull Wire wire) { Bytes<?> bytes = wire.bytes(); bytes.readLimit(bytes.capacity()); return wire; }
if (position > bytes.capacity()) throw new IllegalArgumentException("pos: " + position); if (secondaryAddress > bytes.capacity()) throw new IllegalStateException("sa2: " + secondaryAddress); bytes.readLimit(bytes.capacity()); LongArrayValues indexValues = arrayForAddress(wire, secondaryAddress); int index3 = (int) ((sequenceNumber >>> indexSpacingBits) & (indexCount - 1));
private void inACycleFound(Bytes<?> bytes) { context.closeReadLimit(bytes.capacity()); wire().readAndSetLength(bytes.readPosition()); long end = bytes.readLimit(); context.closeReadPosition(end); Jvm.optionalSafepoint(); }
private boolean inACycle(boolean includeMetaData) throws EOFException { Jvm.optionalSafepoint(); if (readAfterReplicaAcknowledged && inACycleCheckRep()) return false; Jvm.optionalSafepoint(); if (direction != TailerDirection.FORWARD && !inACycleNotForward()) return false; Jvm.optionalSafepoint(); Wire wire = wire(); Bytes<?> bytes = wire.bytes(); bytes.readLimit(bytes.capacity()); switch (wire.readDataHeader(includeMetaData)) { case NONE: Jvm.optionalSafepoint(); // no more polling - appender will always write (or recover) EOF return false; case META_DATA: Jvm.optionalSafepoint(); context.metaData(true); break; case DATA: Jvm.optionalSafepoint(); context.metaData(false); break; } Jvm.optionalSafepoint(); inACycleFound(bytes); Jvm.optionalSafepoint(); return true; }
private void removeEOF(Path path) throws IOException { long blockSize = 64 << 10; long chunkSize = OS.pageAlign(blockSize); long overlapSize = OS.pageAlign(blockSize / 4); final MappedBytes mappedBytes = MappedBytes.mappedBytes(path.toFile(), chunkSize, overlapSize, false); mappedBytes.reserve(); try { final Wire wire = WireType.BINARY_LIGHT.apply(mappedBytes); final Bytes<?> bytes = wire.bytes(); bytes.readLimit(bytes.capacity()); bytes.readSkip(4); // move past header try (final SingleChronicleQueueStore qs = loadStore(wire)) { assertNotNull(qs); long l = qs.writePosition(); long len = Wires.lengthOf(bytes.readVolatileInt(l)); long eofOffset = l + len + 4L; bytes.writePosition(eofOffset); bytes.writeInt(0); } } finally { mappedBytes.release(); } }
/** * grow the buffer if the buffer is elastic, if the buffer is not elastic and there is not * enough capacity then this method will throws {@link java.nio.BufferOverflowException} * * @param size the capacity that you required * @throws IllegalArgumentException if the buffer is not elastic and there is not enough space */ default void ensureCapacity(long size) throws IllegalArgumentException { if (size > capacity()) throw new IllegalArgumentException(isElastic() ? "todo" : "not elastic"); }
public Bytes segmentBytesForRead() { segmentBytes.readLimit(segmentBytes.capacity()); return segmentBytes; }
public Bytes segmentBytesForRead() { segmentBytes.readLimit(segmentBytes.capacity()); return segmentBytes; }
public Bytes segmentBytesForRead() { segmentBytes.readLimit(segmentBytes.capacity()); return segmentBytes; }
public Bytes segmentBytesForRead() { segmentBytes.readLimit(segmentBytes.capacity()); return segmentBytes; }
@NotNull private Wire readAnywhere(@NotNull Wire wire) { Bytes<?> bytes = wire.bytes(); bytes.readLimit(bytes.capacity()); return wire; }
@Stage("Segment") public Bytes segmentBytesForRead() { segmentBytes.readLimit(segmentBytes.capacity()); return segmentBytes; }
/** * @return is the readPosition at the start and the writeLimit at the end. */ @Override default boolean isClear() { return start() == readPosition() && writeLimit() == capacity(); }
if (position > bytes.capacity()) throw new IllegalArgumentException("pos: " + position); if (secondaryAddress > bytes.capacity()) throw new IllegalStateException("sa2: " + secondaryAddress); bytes.readLimit(bytes.capacity()); LongArrayValues indexValues = arrayForAddress(wire, secondaryAddress); int index3 = (int) ((sequenceNumber >>> indexSpacingBits) & (indexCount - 1));
private void inACycleFound(Bytes<?> bytes) { context.closeReadLimit(bytes.capacity()); wire().readAndSetLength(bytes.readPosition()); long end = bytes.readLimit(); context.closeReadPosition(end); Jvm.optionalSafepoint(); }
bs.readLimit(bs.capacity()); bs.readPosition(keySizeOffset); long keySize = keySizeMarshaller.readSize(bs);
private boolean inACycle(boolean includeMetaData) throws EOFException { Jvm.optionalSafepoint(); if (readAfterReplicaAcknowledged && inACycleCheckRep()) return false; Jvm.optionalSafepoint(); if (direction != TailerDirection.FORWARD && !inACycleNotForward()) return false; Jvm.optionalSafepoint(); Wire wire = wire(); Bytes<?> bytes = wire.bytes(); bytes.readLimit(bytes.capacity()); switch (wire.readDataHeader(includeMetaData)) { case NONE: Jvm.optionalSafepoint(); // no more polling - appender will always write (or recover) EOF return false; case META_DATA: Jvm.optionalSafepoint(); context.metaData(true); break; case DATA: Jvm.optionalSafepoint(); context.metaData(false); break; } Jvm.optionalSafepoint(); inACycleFound(bytes); Jvm.optionalSafepoint(); return true; }
return -1; if (e.keyEnd() > s.segmentBytes.capacity()) { report(corruptionListener, corruption, segmentIndex, () -> format("Wrong key size: {}", e.keySize) if (entryAndChecksumEnd > s.segmentBytes.capacity()) { report(corruptionListener, corruption, segmentIndex, () -> format("Wrong value size: {}, key: {}", e.valueSize, e.key())
return -1; if ((this.keyEnd()) > (this.segmentBytes().capacity())) { ChronicleHashCorruptionImpl.report(corruptionListener, corruption, segmentIndex, () -> ChronicleHashCorruptionImpl.format("Wrong key size: {}", this.keySize())); return -1; if (entryAndChecksumEnd > (this.segmentBytes().capacity())) { ChronicleHashCorruptionImpl.report(corruptionListener, corruption, segmentIndex, () -> ChronicleHashCorruptionImpl.format("Wrong value size: {}, key: {}", this.valueSize(), this.key())); return -1;
return -1; if ((this.keyEnd()) > (this.segmentBytes().capacity())) { ChronicleHashCorruptionImpl.report(corruptionListener, corruption, segmentIndex, () -> ChronicleHashCorruptionImpl.format("Wrong key size: {}", this.keySize())); return -1; if (entryAndChecksumEnd > (this.segmentBytes().capacity())) { ChronicleHashCorruptionImpl.report(corruptionListener, corruption, segmentIndex, () -> ChronicleHashCorruptionImpl.format("Wrong value size: {}, key: {}", this.valueSize(), this.key())); return -1;