Search in sources :

Example 1 with RecordingDescriptorConsumer

use of io.aeron.archive.client.RecordingDescriptorConsumer in project Aeron by real-logic.

the class EmbeddedReplayThroughput method findRecordingId.

private long findRecordingId(final String expectedChannel) {
    final MutableLong foundRecordingId = new MutableLong();
    final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> foundRecordingId.set(recordingId);
    final int recordingsFound = aeronArchive.listRecordingsForUri(0L, 10, expectedChannel, STREAM_ID, consumer);
    if (1 != recordingsFound) {
        throw new IllegalStateException("should have been only one recording");
    }
    return foundRecordingId.get();
}
Also used : RecordingPos(io.aeron.archive.status.RecordingPos) MediaDriver(io.aeron.driver.MediaDriver) CACHE_LINE_LENGTH(org.agrona.BitUtil.CACHE_LINE_LENGTH) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer) SampleConfiguration(io.aeron.samples.SampleConfiguration) Archive(io.aeron.archive.Archive) SystemUtil.loadPropertiesFiles(org.agrona.SystemUtil.loadPropertiesFiles) CountersReader(org.agrona.concurrent.status.CountersReader) org.agrona.concurrent(org.agrona.concurrent) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) io.aeron(io.aeron) BufferUtil.allocateDirectAligned(org.agrona.BufferUtil.allocateDirectAligned) Header(io.aeron.logbuffer.Header) MutableLong(org.agrona.collections.MutableLong) NOOP_FRAGMENT_HANDLER(io.aeron.samples.archive.Samples.NOOP_FRAGMENT_HANDLER) ArchivingMediaDriver(io.aeron.archive.ArchivingMediaDriver) SourceLocation(io.aeron.archive.codecs.SourceLocation) MEGABYTE(io.aeron.samples.archive.Samples.MEGABYTE) AeronArchive(io.aeron.archive.client.AeronArchive) ContinueBarrier(org.agrona.console.ContinueBarrier) CloseHelper(org.agrona.CloseHelper) DirectBuffer(org.agrona.DirectBuffer) ARCHIVE_DIR_DEFAULT(io.aeron.archive.Archive.Configuration.ARCHIVE_DIR_DEFAULT) MutableLong(org.agrona.collections.MutableLong) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer)

Example 2 with RecordingDescriptorConsumer

use of io.aeron.archive.client.RecordingDescriptorConsumer in project aeron by real-logic.

the class EmbeddedReplayThroughput method findRecordingId.

private long findRecordingId(final String expectedChannel) {
    final MutableLong foundRecordingId = new MutableLong();
    final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> foundRecordingId.set(recordingId);
    final int recordingsFound = aeronArchive.listRecordingsForUri(0L, 10, expectedChannel, STREAM_ID, consumer);
    if (1 != recordingsFound) {
        throw new IllegalStateException("should have been only one recording");
    }
    return foundRecordingId.get();
}
Also used : RecordingPos(io.aeron.archive.status.RecordingPos) MediaDriver(io.aeron.driver.MediaDriver) CACHE_LINE_LENGTH(org.agrona.BitUtil.CACHE_LINE_LENGTH) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer) SampleConfiguration(io.aeron.samples.SampleConfiguration) Archive(io.aeron.archive.Archive) SystemUtil.loadPropertiesFiles(org.agrona.SystemUtil.loadPropertiesFiles) CountersReader(org.agrona.concurrent.status.CountersReader) org.agrona.concurrent(org.agrona.concurrent) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) io.aeron(io.aeron) BufferUtil.allocateDirectAligned(org.agrona.BufferUtil.allocateDirectAligned) Header(io.aeron.logbuffer.Header) MutableLong(org.agrona.collections.MutableLong) NOOP_FRAGMENT_HANDLER(io.aeron.samples.archive.Samples.NOOP_FRAGMENT_HANDLER) ArchivingMediaDriver(io.aeron.archive.ArchivingMediaDriver) SourceLocation(io.aeron.archive.codecs.SourceLocation) MEGABYTE(io.aeron.samples.archive.Samples.MEGABYTE) AeronArchive(io.aeron.archive.client.AeronArchive) ContinueBarrier(org.agrona.console.ContinueBarrier) CloseHelper(org.agrona.CloseHelper) DirectBuffer(org.agrona.DirectBuffer) ARCHIVE_DIR_DEFAULT(io.aeron.archive.Archive.Configuration.ARCHIVE_DIR_DEFAULT) MutableLong(org.agrona.collections.MutableLong) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer)

Example 3 with RecordingDescriptorConsumer

use of io.aeron.archive.client.RecordingDescriptorConsumer in project aeron by real-logic.

the class BasicArchiveTest method findRecordingId.

private long findRecordingId(final String expectedChannel, final int expectedStreamId, final long expectedPosition) {
    final MutableLong foundRecordingId = new MutableLong();
    final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> {
        foundRecordingId.set(recordingId);
        assertEquals(0L, startPosition);
        assertEquals(expectedPosition, stopPosition);
        assertEquals(expectedStreamId, streamId);
        assertEquals(expectedChannel, originalChannel);
    };
    final int recordingsFound = aeronArchive.listRecordingsForUri(0L, 10, expectedChannel, expectedStreamId, consumer);
    assertThat(recordingsFound, greaterThan(0));
    return foundRecordingId.get();
}
Also used : RecordingPos(io.aeron.archive.status.RecordingPos) MediaDriver(io.aeron.driver.MediaDriver) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer) CountersReader(org.agrona.concurrent.status.CountersReader) LOCAL(io.aeron.archive.codecs.SourceLocation.LOCAL) Test(org.junit.Test) ExpandableArrayBuffer(org.agrona.ExpandableArrayBuffer) IoUtil(org.agrona.IoUtil) File(java.io.File) Assert.assertThat(org.junit.Assert.assertThat) io.aeron(io.aeron) MutableLong(org.agrona.collections.MutableLong) ThreadingMode(io.aeron.driver.ThreadingMode) After(org.junit.After) AeronArchive(io.aeron.archive.client.AeronArchive) Is.is(org.hamcrest.core.Is.is) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) FragmentHandler(io.aeron.logbuffer.FragmentHandler) MutableInteger(org.agrona.collections.MutableInteger) CloseHelper(org.agrona.CloseHelper) NULL_POSITION(io.aeron.archive.client.AeronArchive.NULL_POSITION) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) MutableLong(org.agrona.collections.MutableLong) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer)

Example 4 with RecordingDescriptorConsumer

use of io.aeron.archive.client.RecordingDescriptorConsumer in project aeron by real-logic.

the class EmbeddedReplayThroughput method findRecordingId.

private long findRecordingId(final String expectedChannel, final int expectedStreamId) {
    final MutableLong foundRecordingId = new MutableLong();
    final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> foundRecordingId.set(recordingId);
    final int recordingsFound = aeronArchive.listRecordingsForUri(0L, 10, expectedChannel, expectedStreamId, consumer);
    if (1 != recordingsFound) {
        throw new IllegalStateException("Should have been one recording");
    }
    return foundRecordingId.get();
}
Also used : MediaDriver(io.aeron.driver.MediaDriver) FRAME_ALIGNMENT(io.aeron.logbuffer.FrameDescriptor.FRAME_ALIGNMENT) NOOP_FRAGMENT_HANDLER(io.aeron.samples.archive.TestUtil.NOOP_FRAGMENT_HANDLER) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer) SampleConfiguration(io.aeron.samples.SampleConfiguration) MEGABYTE(io.aeron.samples.archive.TestUtil.MEGABYTE) Archive(io.aeron.archive.Archive) SystemUtil.loadPropertiesFiles(org.agrona.SystemUtil.loadPropertiesFiles) UnsafeBuffer(org.agrona.concurrent.UnsafeBuffer) File(java.io.File) io.aeron(io.aeron) BufferUtil.allocateDirectAligned(org.agrona.BufferUtil.allocateDirectAligned) Header(io.aeron.logbuffer.Header) MutableLong(org.agrona.collections.MutableLong) ArchivingMediaDriver(io.aeron.archive.ArchivingMediaDriver) AeronArchive(io.aeron.archive.client.AeronArchive) ContinueBarrier(org.agrona.console.ContinueBarrier) FragmentHandler(io.aeron.logbuffer.FragmentHandler) CloseHelper(org.agrona.CloseHelper) DirectBuffer(org.agrona.DirectBuffer) ARCHIVE_DIR_DEFAULT(io.aeron.archive.Archive.Configuration.ARCHIVE_DIR_DEFAULT) MutableLong(org.agrona.collections.MutableLong) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer)

Example 5 with RecordingDescriptorConsumer

use of io.aeron.archive.client.RecordingDescriptorConsumer in project Aeron by real-logic.

the class ReplayedBasicSubscriber method findLatestRecording.

private static long findLatestRecording(final AeronArchive archive) {
    final MutableLong lastRecordingId = new MutableLong();
    final RecordingDescriptorConsumer consumer = (controlSessionId, correlationId, recordingId, startTimestamp, stopTimestamp, startPosition, stopPosition, initialTermId, segmentFileLength, termBufferLength, mtuLength, sessionId, streamId, strippedChannel, originalChannel, sourceIdentity) -> lastRecordingId.set(recordingId);
    final long fromRecordingId = 0L;
    final int recordCount = 100;
    final int foundCount = archive.listRecordingsForUri(fromRecordingId, recordCount, CHANNEL, STREAM_ID, consumer);
    if (foundCount == 0) {
        throw new IllegalStateException("no recordings found");
    }
    return lastRecordingId.get();
}
Also used : MutableLong(org.agrona.collections.MutableLong) Subscription(io.aeron.Subscription) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer) SampleConfiguration(io.aeron.samples.SampleConfiguration) AeronArchive(io.aeron.archive.client.AeronArchive) ChannelUri(io.aeron.ChannelUri) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FragmentHandler(io.aeron.logbuffer.FragmentHandler) SamplesUtil(io.aeron.samples.SamplesUtil) SigInt(org.agrona.concurrent.SigInt) MutableLong(org.agrona.collections.MutableLong) RecordingDescriptorConsumer(io.aeron.archive.client.RecordingDescriptorConsumer)

Aggregations

AeronArchive (io.aeron.archive.client.AeronArchive)6 RecordingDescriptorConsumer (io.aeron.archive.client.RecordingDescriptorConsumer)6 MutableLong (org.agrona.collections.MutableLong)6 SampleConfiguration (io.aeron.samples.SampleConfiguration)5 io.aeron (io.aeron)4 MediaDriver (io.aeron.driver.MediaDriver)4 FragmentHandler (io.aeron.logbuffer.FragmentHandler)4 File (java.io.File)4 CloseHelper (org.agrona.CloseHelper)4 Archive (io.aeron.archive.Archive)3 ARCHIVE_DIR_DEFAULT (io.aeron.archive.Archive.Configuration.ARCHIVE_DIR_DEFAULT)3 ArchivingMediaDriver (io.aeron.archive.ArchivingMediaDriver)3 RecordingPos (io.aeron.archive.status.RecordingPos)3 Header (io.aeron.logbuffer.Header)3 BufferUtil.allocateDirectAligned (org.agrona.BufferUtil.allocateDirectAligned)3 DirectBuffer (org.agrona.DirectBuffer)3 SystemUtil.loadPropertiesFiles (org.agrona.SystemUtil.loadPropertiesFiles)3 CountersReader (org.agrona.concurrent.status.CountersReader)3 ContinueBarrier (org.agrona.console.ContinueBarrier)3 ChannelUri (io.aeron.ChannelUri)2