boolean forEntry(final long recordingId, final CatalogEntryProcessor consumer)
    {
        if (recordingId < 0)
        {
            return false;
        }

        final int recordingDescriptorOffset = recordingDescriptorOffset(recordingId);
        if (recordingDescriptorOffset < 0)
        {
            return false;
        }

        if (wrapDescriptorAtOffset(catalogBuffer, recordingDescriptorOffset) > 0)
        {
            invokeEntryProcessor(recordingDescriptorOffset, consumer);

            return true;
        }

        return false;
    }
@Test
    void shouldFixTimestampForEmptyRecordingAfterFailure()
    {
        final long newRecordingId = newRecording();

        try (Catalog catalog = new Catalog(archiveDir, clock))
        {
            final CatalogEntryProcessor entryProcessor =
                (recordingDescriptorOffset, headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder) ->
                assertEquals(NULL_TIMESTAMP, descriptorDecoder.stopTimestamp());

            assertTrue(catalog.forEntry(newRecordingId, entryProcessor));
        }

        currentTimeMs = 42L;

        try (Catalog catalog = new Catalog(archiveDir, null, 0, CAPACITY, clock, null, segmentFileBuffer))
        {
            final CatalogEntryProcessor entryProcessor =
                (recordingDescriptorOffset, headerEncoder, headerDecoder, descriptorEncoder, descriptorDecoder) ->
                assertEquals(42L, descriptorDecoder.stopTimestamp());

            assertTrue(catalog.forEntry(newRecordingId, entryProcessor));
        }
    }