pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] david-streamlio commented on a change in pull request #2865: Refactored JCloud Tiered Storage
Date Thu, 01 Nov 2018 00:11:05 GMT
david-streamlio commented on a change in pull request #2865: Refactored JCloud Tiered Storage
URL: https://github.com/apache/pulsar/pull/2865#discussion_r229906884

 File path: tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/provider/BlobStoreRepository.java
 @@ -0,0 +1,85 @@
+ * 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
+ * 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 java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.jclouds.blobstore.BlobStore;
+ * Centralized storage location for all the Blobstore instances
+ * created and used for tiered-storage.
+ * <p>
+ * Users should first check to see if an existing Blobstore for the
+ * the given BlobStoreKey exists, and if so, use the existing one.
+ * Otherwise a new one will be created and added to the Repository
+ * </p>
+ */
+public class BlobStoreRepository {
 Review comment:
   Now I remember why I added the BlobStoreRepository class in the first place. The other
issue that was bothering me was the existence of a "back door" constructor for the BlobStoreManagedLedgerOffloader
class that had the @VisibleForTesting annotation. 
   It was there because the blobStore had to first be created an in unit tests and then passed
in to that constructor. This enabled the ability to both have functional blobStore and spy/mock
it at the same time.  
   I wasn't a big fan of testing this way, as it was a different code path that we were using
than what would actually be executed at runtime. Therefore, I refactored it out, and discovered
that without a way to retain the blobStore instances between unit tests, that all of the unit
tests broke. So the static BlobStoreRepository class was created to fix all of the unit tests
that were broke from removing that one constructor. At this point, removing it would break
all of the unit tests.

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:

With regards,
Apache Git Services

View raw message