private static long getTrimOffset(List<RecordAccumulator.WALObject> objectList, ObjectStorage objectStorage) {
            if (objectList.isEmpty()) {
                return -1;
            }

            RecordAccumulator.WALObject object = objectList.get(objectList.size() - 1);
            ObjectStorage.ReadOptions options = new ObjectStorage.ReadOptions()
                .throttleStrategy(ThrottleStrategy.BYPASS)
                .bucket(object.bucketId());
            ByteBuf buffer = objectStorage.rangeRead(options, object.path(), 0, object.length()).join();
            WALObjectHeader header = WALObjectHeader.unmarshal(buffer);
            buffer.release();
            return header.trimOffset();
        }
Get the latest trim offset from the newest object.
s3stream/src/main/java/com/automq/stream/s3/wal/impl/object/ObjectWALService.java