public < T > CompletableFuture < Map . Entry < ByteBuf , List < Map . Entry < String , VersionedMetadata < T > > > > > getEntriesPaginated ( String tableName , ByteBuf continuationToken , int limit , Function < byte [ ] , T > fromBytes ) { log . trace ( "get entries paginated called for : {}" , tableName ) ; return withRetries ( ( ) -> segmentHelper . readTableEntries ( tableName , limit , IteratorState . fromBytes ( continuationToken ) , authToken . get ( ) , RequestTag . NON_EXISTENT_ID ) , ( ) -> String . format ( "get entries paginated for table: %s" , tableName ) ) . thenApplyAsync ( result -> { List < Map . Entry < String , VersionedMetadata < T > > > items = result . getItems ( ) . stream ( ) . map ( x -> { String key = new String ( x . getKey ( ) . getKey ( ) , Charsets . UTF_8 ) ; T deserialized = fromBytes . apply ( x . getValue ( ) ) ; VersionedMetadata < T > value = new VersionedMetadata <> ( deserialized , new Version . LongVersion ( x . getKey ( ) . getVersion ( ) . getSegmentVersion ( ) ) ) ; return new AbstractMap . SimpleEntry <> ( key , value ) ; } ) . collect ( Collectors . toList ( ) ) ; log . trace ( "get keys paginated on table {} returned number of items {}" , tableName , items . size ( ) ) ; return new AbstractMap . SimpleEntry <> ( result . getState ( ) . toBytes ( ) , items ) ; } , executor ) ; }
Method to get paginated list of entries with a continuation token .