Search in sources :

Example 36 with Checksum

use of io.aeron.archive.checksum.Checksum in project aeron by real-logic.

the class Catalog method updateChecksum.

void updateChecksum(final int recordingDescriptorOffset) {
    final Checksum checksum = this.checksum;
    if (null != checksum) {
        final UnsafeBuffer headerBuffer = this.headerAccessBuffer;
        final int recordingLength = headerBuffer.getInt(recordingDescriptorOffset + RecordingDescriptorHeaderEncoder.lengthEncodingOffset(), BYTE_ORDER);
        final int checksumValue = checksum.compute(catalogByteBufferAddress, DESCRIPTOR_HEADER_LENGTH + recordingDescriptorOffset, recordingLength);
        headerBuffer.putInt(recordingDescriptorOffset + RecordingDescriptorHeaderEncoder.checksumEncodingOffset(), checksumValue, BYTE_ORDER);
    }
}
Also used : Checksum(io.aeron.archive.checksum.Checksum) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer)

Aggregations

Checksum (io.aeron.archive.checksum.Checksum)36 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)26 Catalog (io.aeron.archive.Catalog)22 AeronArchive (io.aeron.archive.client.AeronArchive)16 Test (org.junit.jupiter.api.Test)16 INVALID (io.aeron.archive.codecs.RecordingState.INVALID)14 VALID (io.aeron.archive.codecs.RecordingState.VALID)14 File (java.io.File)14 IOException (java.io.IOException)14 ByteBuffer (java.nio.ByteBuffer)14 FileChannel (java.nio.channels.FileChannel)14 EpochClock (org.agrona.concurrent.EpochClock)14 RECORDING_SEGMENT_SUFFIX (io.aeron.archive.Archive.Configuration.RECORDING_SEGMENT_SUFFIX)12 APPLY_CHECKSUM (io.aeron.archive.ArchiveTool.VerifyOption.APPLY_CHECKSUM)12 VERIFY_ALL_SEGMENT_FILES (io.aeron.archive.ArchiveTool.VerifyOption.VERIFY_ALL_SEGMENT_FILES)12 LogBufferDescriptor.computeTermIdFromPosition (io.aeron.logbuffer.LogBufferDescriptor.computeTermIdFromPosition)12 LogBufferDescriptor.positionBitsToShift (io.aeron.logbuffer.LogBufferDescriptor.positionBitsToShift)12 DataHeaderFlyweight (io.aeron.protocol.DataHeaderFlyweight)12 PrintStream (java.io.PrintStream)12 Path (java.nio.file.Path)12