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 2022/10/08 00:30:10 UTC

[GitHub] [pulsar] rdhabalia commented on a diff in pull request #17711: [feat][broker]PIP-180 Shadow Topic - Part V - Support shadow topic creation.

rdhabalia commented on code in PR #17711:
URL: https://github.com/apache/pulsar/pull/17711#discussion_r990561557


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ShadowManagedLedgerImpl.java:
##########
@@ -0,0 +1,58 @@
+/**
+ * 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.impl;
+
+import java.util.function.Supplier;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.bookkeeper.client.BookKeeper;
+import org.apache.bookkeeper.common.util.OrderedScheduler;
+import org.apache.bookkeeper.mledger.ManagedLedgerConfig;
+import org.apache.pulsar.common.naming.TopicName;
+
+/**
+ * Working in progress until <a href="https://github.com/apache/pulsar/issues/16153">PIP-180</a> is finished.
+ * Currently, it works nothing different with ManagedLedgerImpl.
+ */
+@Slf4j
+public class ShadowManagedLedgerImpl extends ManagedLedgerImpl {
+
+    private final TopicName shadowSource;
+    private final String sourceMLName;
+
+    public ShadowManagedLedgerImpl(ManagedLedgerFactoryImpl factory, BookKeeper bookKeeper,
+                                   MetaStore store, ManagedLedgerConfig config,
+                                   OrderedScheduler scheduledExecutor,
+                                   String name, final Supplier<Boolean> mlOwnershipChecker) {
+        super(factory, bookKeeper, store, config, scheduledExecutor, name, mlOwnershipChecker);
+        this.shadowSource = TopicName.get(config.getShadowSource());
+        this.sourceMLName = shadowSource.getPersistenceNamingEncoding();
+    }
+
+    @Override
+    synchronized void initialize(ManagedLedgerInitializeLedgerCallback callback, Object ctx) {
+        // TODO: ShadowManagedLedger has different initialize process from normal ManagedLedger,

Review Comment:
   we should avoid TODOs and try to implement full PR or make it extendable PR.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org