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

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
 ##########
 @@ -788,89 +852,340 @@ private long readLastLogId(File f) {
         }
     }
 
-    /**
-     * Flushes all rotated log channels. After log channels are flushed,
-     * move leastUnflushedLogId ptr to current logId.
-     */
-    void checkpoint() throws IOException {
-        flushRotatedLogs();
+    interface EntryLogManager {
+
+        /*
+         * add entry to the corresponding entrylog and return the position of
+         * the entry in the entrylog
+         */
+        long addEntry(Long ledger, ByteBuf entry, boolean rollLog) throws 
IOException;
+
+        /*
+         * gets the active logChannel with the given entryLogId. null if it is
+         * not existing.
+         */
+        BufferedLogChannel getCurrentLogIfPresent(long entryLogId);
+
+        /*
+         * 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;
+
+        /*
+         * flush rotated logs.
+         */
+        void flushRotatedLogs() throws IOException;
+
+        /*
+         * flush current logs.
+         */
+        void flushCurrentLogs() throws IOException;
+
+        /*
+         * close current logs.
+         */
+        void closeCurrentLogs() throws IOException;
 
 Review comment:
   the `closeCurrentLogs` and `forceCloseCurrentLogs` are the abstraction of 
the logic during `closing`. I think it is better to call it `close` and 
`closeNow` (or `forceClose`) - meaning closing the manager, force closing the 
manager. This would provide a better meaning and it is similar as `shutdown` 
and `shutdownNow` in scheduler.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to