reddycharan commented on a change in pull request #1281: Issue #570: 
Introducing EntryLogManager.
URL: https://github.com/apache/bookkeeper/pull/1281#discussion_r177188354
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
 ##########
 @@ -802,88 +876,217 @@ private long readLastLogId(File f) {
         }
     }
 
+    interface EntryLogManager {
+        /*
+         * acquire lock for this ledger.
+         */
+        void acquireLock(Long ledgerId);
+
+        /*
+         * acquire lock for this ledger if it is not already available for this
+         * ledger then it will create a new one and then acquire lock.
+         */
+        void acquireLockByCreatingIfRequired(Long ledgerId);
+
+        /*
+         * release lock for this ledger
+         */
+        void releaseLock(Long ledgerId);
+
+        /*
+         * sets the logChannel for the given ledgerId. The previous one will be
+         * removed from replicaOfCurrentLogChannels. Previous logChannel will 
be
+         * added to rotatedLogChannels.
+         */
+        void setCurrentLogForLedger(Long ledgerId, BufferedLogChannel 
logChannel);
+
+        /*
+         * gets the logChannel for the given ledgerId.
+         */
+        BufferedLogChannel getCurrentLogForLedger(Long ledgerId);
+
+        /*
+         * gets the copy of rotatedLogChannels
+         */
+        Set<BufferedLogChannel> getCopyOfRotatedLogChannels();
+
+        /*
+         * gets the copy of replicaOfCurrentLogChannels
+         */
+        Set<BufferedLogChannel> getCopyOfCurrentLogs();
+
+        /*
+         * gets the active logChannel with the given entryLogId. null if it is
+         * not existing.
+         */
+        BufferedLogChannel getCurrentLogIfPresent(long entryLogId);
+
+        /*
+         * removes the logChannel from rotatedLogChannels collection
+         */
+        void removeFromRotatedLogChannels(BufferedLogChannel 
rotatedLogChannelToRemove);
+
+        /*
+         * Returns eligible writable ledger dir for the creation next entrylog
+         */
+        File getDirForNextEntryLog(List<File> writableLedgerDirs);
+
+        /*
+         * Do the operations required for checkpoint.
+         */
+        void checkpoint() throws IOException;
+
+        /*
+         * roll entryLogs.
+         */
+        void rollLogs() throws IOException;
+    }
+
+    class EntryLogManagerForSingleEntryLog implements EntryLogManager {
 
 Review comment:
   will do

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