david-streamlio commented on a change in pull request #2865: Refactored JCloud Tiered Storage URL: https://github.com/apache/pulsar/pull/2865#discussion_r229782497
########## File path: tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/provider/TieredStorageConfiguration.java ########## @@ -0,0 +1,212 @@ +/** + * 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.provider; + +import com.google.common.collect.ImmutableMap; + +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.stream.Collectors; + +import org.jclouds.Constants; +import org.jclouds.blobstore.BlobStore; +import org.jclouds.domain.Credentials; +import org.jclouds.providers.ProviderMetadata; + +/** + * Class responsible for holding all of the tiered storage configuration data + * that is set in the global Pulsar broker.conf file. + * <p> + * This class is used by the BlobStoreManagedLedgerOffloader to determine which + * JCloud provider to use for Tiered Storage offloand, along with the associated + * properties such as region, bucket, user credentials, etc. + * </p> + */ +public class TieredStorageConfiguration implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + public static final String BLOB_STORE_PROVIDER_KEY = "managedLedgerOffloadDriver"; + public static final String METADATA_FIELD_BLOB_STORE_PROVIDER = "provider"; + public static final String METADATA_FIELD_BUCKET = "bucket"; + public static final String METADATA_FIELD_REGION = "region"; + public static final String METADATA_FIELD_ENDPOINT = "endpoint"; + protected static final int MB = 1024 * 1024; + + public static TieredStorageConfiguration create(Properties props) throws IOException { Review comment: Actually I did intend to rename these properties in an effort to simplify the configuration of the tiered storage. The goal was to reuse the common terms such as "bucket" and "region", rather than have two separate properties for each JCloud provider. As we add more providers, the broker.conf file will become filled with lots of non-used properties. This also simplifies the documentation required for new providers by eliminating the need for a separate, nearly-identical section on how to set "azureManagedLedgerOffloadBucket" & "s3ManagedLedgerOffloadRegion" vs. "s3ManagedLedgerOffloadBucket" & "s3ManagedLedgerOffloadRegion" Once the provider is configured, we know that the bucket/region apply to that provider and we can just have "provider", "region" and "bucket" properties. To address BC issues, we could continue to support the previous property names for a while, but flag them as deprecated, and eventually remove them? Fortunately this change only affects the broker.conf file and not existing data blocks that have been offloaded ---------------------------------------------------------------- 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
