merlimat commented on a change in pull request #1218: Support LacPiggyback, 
LongPoll and ExplicitLac in db ledger storage
URL: https://github.com/apache/bookkeeper/pull/1218#discussion_r171322790
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java
 ##########
 @@ -74,10 +83,121 @@
  */
 public class DbLedgerStorage implements CompactableLedgerStorage {
 
+    /**
+     * This class borrows the logic from FileInfo.
+     *
+     * <p>This class is used for holding all the transient states for a given 
ledger.
+     */
+    private static class TransientLedgerInfo
+            extends Watchable<LastAddConfirmedUpdateNotification>
+            implements AutoCloseable {
+
+        // lac
+        private Long lac = null;
+        // request from explicit lac requests
+        private ByteBuffer explicitLac = null;
+        // is the ledger info closed?
+        private boolean isClosed;
+
+        private final long ledgerId;
+        // reference to LedgerMetadataIndex
+        private final LedgerMetadataIndex ledgerIndex;
+
+        /**
+         * Construct an Watchable with zero watchers.
+         */
+        public TransientLedgerInfo(long ledgerId, LedgerMetadataIndex 
ledgerIndex) {
+            super(WATCHER_RECYCLER);
+            this.ledgerId = ledgerId;
+            this.ledgerIndex = ledgerIndex;
+        }
+
+        synchronized Long getLastAddConfirmed() {
+            return lac;
+        }
+
+        Long setLastAddConfirmed(long lac) {
 
 Review comment:
   This could return `long` here since `lacToReturn` is already `long`.

----------------------------------------------------------------
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

Reply via email to