use of io.aeron.archive.Catalog in project aeron by real-logic.
the class CatalogTest method shouldAllowMultipleInstancesForSameStream.
@Test
void shouldAllowMultipleInstancesForSameStream() {
try (Catalog catalog = new Catalog(archiveDir, clock)) {
assertEquals(CAPACITY, catalog.capacity());
final long newRecordingId = newRecording();
assertNotEquals(recordingOneId, newRecordingId);
}
}
use of io.aeron.archive.Catalog 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.Catalog in project aeron by real-logic.
the class CatalogTest method shouldGrowCatalogWhenMaxCapacityReached.
@Test
void shouldGrowCatalogWhenMaxCapacityReached() {
after();
final File archiveDir = ArchiveTests.makeTestDirectory();
try (Catalog catalog = new Catalog(archiveDir, null, 0, MIN_CAPACITY, clock, null, segmentFileBuffer)) {
for (int i = 0; i < 4; i++) {
recordingOneId = catalog.addNewRecording(0L, 0L, 0, SEGMENT_LENGTH, TERM_LENGTH, MTU_LENGTH, 6, 1, "channelG", "channelG?tag=f", "sourceA");
}
}
try (Catalog catalog = new Catalog(archiveDir, clock)) {
assertEquals(4, catalog.entryCount());
assertEquals(819, catalog.capacity());
}
}
use of io.aeron.archive.Catalog in project aeron by real-logic.
the class CatalogTest method shouldReadNextRecordingIdFromCatalogHeader.
@Test
void shouldReadNextRecordingIdFromCatalogHeader() throws IOException {
final long nextRecordingId = 10101010;
setNextRecordingId(nextRecordingId);
try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, null, segmentFileBuffer)) {
assertEquals(nextRecordingId, catalog.nextRecordingId());
}
}
use of io.aeron.archive.Catalog in project aeron by real-logic.
the class ArchiveTool method dump.
/**
* Dump the contents of an {@link Archive} so it can be inspected or debugged. Each recording will have its
* contents dumped up to fragmentCountLimit before requesting to continue.
*
* @param out to which the contents will be printed.
* @param archiveDir containing the {@link Archive}.
* @param fragmentCountLimit limit of data fragments to print from each recording before continue.
* @param confirmActionOnFragmentCountLimit confirm continue to dump at limit.
*/
public static void dump(final PrintStream out, final File archiveDir, final long fragmentCountLimit, final ActionConfirmation<Long> confirmActionOnFragmentCountLimit) {
try (Catalog catalog = openCatalogReadOnly(archiveDir, INSTANCE);
ArchiveMarkFile markFile = openMarkFile(archiveDir, out::println)) {
printMarkInformation(markFile, out);
out.println("Catalog capacity in bytes: " + catalog.capacity());
out.println();
out.println("Dumping up to " + fragmentCountLimit + " fragments per recording");
catalog.forEach((recordingDescriptorOffset, headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder) -> dump(out, archiveDir, catalog, fragmentCountLimit, confirmActionOnFragmentCountLimit, headerDecoder, descriptorDecoder));
}
}
Aggregations