use of io.aeron.archive.checksum.Checksum in project Aeron by real-logic.
the class ArchiveTool method createVerifyEntryProcessor.
private static CatalogEntryProcessor createVerifyEntryProcessor(final PrintStream out, final File archiveDir, final Set<VerifyOption> options, final Catalog catalog, final Checksum checksum, final EpochClock epochClock, final MutableInteger errorCount, final ActionConfirmation<File> truncateOnPageStraddle) {
final ByteBuffer buffer = BufferUtil.allocateDirectAligned(FILE_IO_MAX_LENGTH_DEFAULT, CACHE_LINE_LENGTH);
buffer.order(LITTLE_ENDIAN);
final DataHeaderFlyweight headerFlyweight = new DataHeaderFlyweight(buffer);
return (recordingDescriptorOffset, headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder) -> verifyRecording(out, archiveDir, options, catalog, checksum, epochClock, errorCount, truncateOnPageStraddle, headerFlyweight, recordingDescriptorOffset, headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder);
}
use of io.aeron.archive.checksum.Checksum in project Aeron by real-logic.
the class ArchiveTest method recordChecksumBufferReturnsValueAssignedIfThreadingModeIsDEDICATED.
@Test
void recordChecksumBufferReturnsValueAssignedIfThreadingModeIsDEDICATED() {
final UnsafeBuffer buffer = mock(UnsafeBuffer.class);
final Checksum recordChecksum = mock(Checksum.class);
final Archive.Context context = new Archive.Context().recordChecksum(recordChecksum).threadingMode(DEDICATED);
context.recordChecksumBuffer(buffer);
assertSame(buffer, context.recordChecksumBuffer());
}
use of io.aeron.archive.checksum.Checksum in project Aeron by real-logic.
the class CatalogTest method extendRecordingShouldUpdateChecksum.
@Test
void extendRecordingShouldUpdateChecksum() {
final Checksum checksum = crc32();
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, checksum, segmentFileBuffer)) {
final long recordingId = catalog.addNewRecording(0L, 0L, 0, SEGMENT_LENGTH, TERM_LENGTH, MTU_LENGTH, 6, 1, "channelNew", "channelNew?tag=X", "sourceX");
assertChecksum(catalog, recordingId, 1691549102);
catalog.extendRecording(recordingId, 555, 13, 31);
assertChecksum(catalog, recordingId, -1694749833);
}
}
use of io.aeron.archive.checksum.Checksum in project Aeron by real-logic.
the class CatalogTest method recordingStoppedShouldUpdateChecksum.
@Test
void recordingStoppedShouldUpdateChecksum() {
final Checksum checksum = crc32();
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, checksum, segmentFileBuffer)) {
assertChecksum(catalog, recordingOneId, 0);
catalog.recordingStopped(recordingOneId, 140, 231723682323L);
assertChecksum(catalog, recordingOneId, 1656993099);
}
}
use of io.aeron.archive.checksum.Checksum in project Aeron by real-logic.
the class CatalogTest method stopPositionShouldUpdateChecksum.
@Test
void stopPositionShouldUpdateChecksum() {
final Checksum checksum = crc32();
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, checksum, segmentFileBuffer)) {
assertChecksum(catalog, recordingTwoId, 0);
catalog.stopPosition(recordingTwoId, 7777);
assertChecksum(catalog, recordingTwoId, -1985007076);
}
}
Aggregations