keith-turner commented on issue #967: Prototype adding async get methods to 
Transaction
URL: https://github.com/apache/fluo/issues/967#issuecomment-343997082
 
 
   You could add a default method to SnapShotBase like the following. 
   
   ```java
     default CompletableFuture<String> getsAsync(String row, Column column) {
       return CompletableFuture.completedFuture(gets(row, column));
     }
   ```
   
   This default method is actually synchronous and blocks.  However it provides 
a default impl for any existing classes that implement the interface and do not 
provide this new method.
   
   You will want to override this in [TransactionImpl] and provide an impl that 
is async.  The TransactionImpl class is a bit too big, it needs to be 
refactored.  Could possibly put this async get functionality in its own class 
and have TransactionImpl call it.  Maybe something like the following.
   
   ```java
   class AsyncReader {
      private queue
      private executor
   
     AsyncReader(TransactionImpl tx) {//TODO}
     CompletableFuture<String> gets(String row, String column) {//TODO}
     void close() {//TODO clean up any resource, like shutdown thread pool}
   }
   ```
   
   
   
   
   
[TransactionImpl]:https://github.com/apache/fluo/blob/eb0889b5609292370b4569c576d2aee87c86f04b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java

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