You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/02 09:55:58 UTC
[GitHub] [pulsar] sijie commented on a change in pull request #9397: [ML] Make ManagedLedger storage configurable
sijie commented on a change in pull request #9397:
URL: https://github.com/apache/pulsar/pull/9397#discussion_r568467892
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/storage/ManagedLedgerStorage.java
##########
@@ -0,0 +1,95 @@
+/**
+ * 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.pulsar.broker.storage;
+
+import java.io.IOException;
+import org.apache.bookkeeper.client.BookKeeper;
+import org.apache.bookkeeper.mledger.ManagedLedgerFactory;
+import org.apache.bookkeeper.stats.StatsProvider;
+import org.apache.pulsar.broker.BookKeeperClientFactory;
+import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.common.classification.InterfaceAudience.Private;
+import org.apache.pulsar.common.classification.InterfaceStability.Unstable;
+import org.apache.zookeeper.ZooKeeper;
+
+/**
+ * Storage to access {@link org.apache.bookkeeper.mledger.ManagedLedger}s.
+ */
+@Private
+@Unstable
+public interface ManagedLedgerStorage extends AutoCloseable {
+
+ /**
+ * Initialize the managed ledger storage.
+ *
+ * @param conf service config
+ * @param zkClient zk client
+ * @param bookkeperProvider bookkeeper provider
+ * @throws Exception
+ */
+ void initialize(ServiceConfiguration conf,
+ ZooKeeper zkClient,
+ BookKeeperClientFactory bookkeperProvider) throws Exception;
+
+ /**
+ * Return the factory to create {@link ManagedLedgerFactory}.
+ *
+ * @return the factory to create {@link ManagedLedgerFactory}.
+ */
+ ManagedLedgerFactory getManagedLedgerFactory();
+
+ /**
+ * Return the stats provider to expose the stats of the storage implementation.
+ *
+ * @return the stats provider.
+ */
+ StatsProvider getStatsProvider();
+
+ /**
+ * Return the default bookkeeper client.
+ *
+ * @return the default bookkeeper client.
+ */
+ BookKeeper getBookKeeperClient();
Review comment:
@codelipenghui This is the first attempt to provide an interface. It is a bit difficult to hide everything at this moment. Hence I marked the interface as private and unstable. So we can iterate changes over this interface.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org