nsivabalan commented on PR #13077:
URL: https://github.com/apache/hudi/pull/13077#issuecomment-2776492281

   We might need something like below 
   ```
   public interface TimeGenerator {
   
     /**
      * Generates a globally monotonically increasing timestamp. The 
implementation must ensure that
      * a new generated timestamp T is guaranteed to be greater than
      * any timestamp generated by the preceding calls.
      *
      * @param skipLocking If this is triggered by another parent transaction, 
locking can be skipped.
      * @return Current TrueTime as milliseconds.
      */
     default long generateTime(boolean skipLocking) {
       synchronized (this) {
         return generateTimeInternal(skipLocking);
       }
     }
   
     long generateTimeInternal(boolean skipLocking);
   
     /**
      * Passes an auto generated timestamp to the given function {@code func}. 
The implementations
      * need to ensure timestamp generation and executing func are atomic.
      *
      * @param skipLocking If this is triggered by another parent transaction, 
locking can be skipped.
      * @param func   A consumer that takes a monotonically increasing 
timestamp.
      */
     default void consumeTime(boolean skipLocking, Consumer<Long> func) {
       synchronized (this) {
         consumeTimeInternal(skipLocking, func);
       }
     }
   
     void consumeTimeInternal(boolean skipLocking, Consumer<Long> func);
   ```
   
   so that we are future proof. any new impl of TimeGenerator does not need to 
ensure they "synchronize" the impl methods. 
   
   
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to