public void write(ImageWriter writer, ImageWriterOptions options) {
        if (objects == null || registryRef == RegistryRef.NOOP) {
            return;
        }

        writer.write(
            new ApiMessageAndVersion(
                new AssignedS3ObjectIdRecord().setAssignedS3ObjectId(nextAssignedObjectId - 1), (short) 0));
        // the writer#write maybe slow, so we use a copy to avoid holding the lock for a long time
        List<S3Object> copy = registryRef.inLock(() -> new ArrayList<>(objects.values(registryRef.epoch())));

        copy.forEach(v -> writer.write(v.toRecord(options.metadataVersion().autoMQVersion())));
    }
Represents the S3 objects in the metadata image.
<p>
This class is thread-safe.
metadata/src/main/java/org/apache/kafka/image/S3ObjectsImage.java