synchronized long appendedBytes() {
            ObjectSerializationCache objectCache = new ObjectSerializationCache();

            return batches
                .values()
                .stream()
                .flatMapToInt(batch -> {
                    if (batch instanceof LocalRecordBatch) {
                        LocalRecordBatch localBatch = (LocalRecordBatch) batch;
                        return localBatch.records.stream().mapToInt(record -> messageSize(record, objectCache));
                    } else {
                        return IntStream.empty();
                    }
                })
                .sum();
        }
Returns the snapshot id of the latest snapshot if there is one.

If a snapshot doesn't exists, it return an empty Optional.
metadata/src/test/java/org/apache/kafka/metalog/LocalLogManager.java