wchevreuil commented on code in PR #7124:
URL: https://github.com/apache/hbase/pull/7124#discussion_r2194650528


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomTieredCompactor.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.hadoop.hbase.regionserver.compactions;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ExtendedCell;
+import org.apache.hadoop.hbase.regionserver.CustomTieringMultiFileWriter;
+import org.apache.hadoop.hbase.regionserver.DateTieredMultiFileWriter;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.yetus.audience.InterfaceAudience;
+
[email protected]
+public class CustomTieredCompactor extends DateTieredCompactor {
+
+  public static final String TIERING_VALUE_PROVIDER =
+    "hbase.hstore.custom-tiering-value.provider.class";
+  private TieringValueProvider tieringValueProvider;
+
+  public CustomTieredCompactor(Configuration conf, HStore store) throws 
IOException {
+    super(conf, store);
+    String className =
+      conf.get(TIERING_VALUE_PROVIDER, 
CustomCellTieringValueProvider.class.getName());
+    try {
+      tieringValueProvider =
+        (TieringValueProvider) 
Class.forName(className).getConstructor().newInstance();
+      tieringValueProvider.init(conf);
+    } catch (Exception e) {
+      throw new IOException("Unable to load configured tiering value provider 
'" + className + "'",
+        e);
+    }
+  }
+
+  @Override
+  protected List<ExtendedCell> decorateCells(List<ExtendedCell> cells) {
+    return tieringValueProvider.decorateCells(cells);
+  }
+
+  @Override
+  protected DateTieredMultiFileWriter createMultiWriter(final 
CompactionRequestImpl request,
+    final List<Long> lowerBoundaries, final Map<Long, String> 
lowerBoundariesPolicies) {
+    return new CustomTieringMultiFileWriter(lowerBoundaries, 
lowerBoundariesPolicies,
+      needEmptyFile(request), 
CustomTieredCompactor.this.tieringValueProvider::getTieringValue);
+  }
+
+  public interface TieringValueProvider {

Review Comment:
   I thought put it there since it's a simple three method interface with a 
tight coupling to the custom tiered compactor. Can move to it's own file, if 
you feel it's needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to