ivankelly commented on a change in pull request #2865: Refactored JCloud Tiered Storage URL: https://github.com/apache/pulsar/pull/2865#discussion_r229602674
########## File path: tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/DataBlockUtils.java ########## @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.bookkeeper.mledger.offload.jcloud.impl; + +import com.google.common.collect.ImmutableMap; + +import java.io.IOException; +import java.util.Map; +import java.util.UUID; + +import org.jclouds.blobstore.domain.Blob; +import org.jclouds.blobstore.domain.BlobBuilder; + +/** + * Utility class for performing various Data Block functions including: + * - Calculating the data block offload key + * - Calculating the data block index key + * - Adding version metadata information to a Data Block + * - Validating the version metadata information of a Data Block. + * <p> + * Additional functions can be added in to future to tag Data Blocks with + * information such as the compression algorithm used to compress the contents, + * the md5 checksum of the content for validation, date published, etc. + * </p> + */ +public class DataBlockUtils { + + /** + * Version checking marker interface. + */ + public interface VersionCheck { + void check(String key, Blob blob) throws IOException; + } + + public static final String METADATA_FORMAT_VERSION_KEY = "ManagedLedgerOffloaderFormatVersion"; Review comment: This is a hard one to change, because there'd have to be a two phase change. If a node with the change write a blob, and there was still a node without the change running, then the node without the change wouldn't be able to read the block. So you need to have all nodes running a version which accepts the change before actually writing blobs with the change. So leaving it as it is is the easiest option for now. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
