Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch reads options added #61

Merged
merged 1 commit into from
Sep 25, 2019
Merged

batch reads options added #61

merged 1 commit into from
Sep 25, 2019

Conversation

kptfh
Copy link
Collaborator

@kptfh kptfh commented Sep 25, 2019

No description provided.

}

public Map<StaticBuffer,EntryList> getSlice(String storeName, List<StaticBuffer> keys, SliceQuery query, StoreTransaction txh) throws BackendException {
if(keys.size() == 1){
StaticBuffer key = keys.get(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to abstraction level better to extract get single element logic to separate method

return Collections.singletonMap(key,
getSlice(storeName, new KeySliceQuery(key, query.getSliceStart(), query.getSliceEnd()), txh));
} else if(keys.size() < bathReadThreshold){
return getSliceParallel(storeName, keys, query, txh);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather rename it to getSliceInParallel

}
}

public Map<StaticBuffer,EntryList> getSliceBatch(String storeName, List<StaticBuffer> keys, SliceQuery query, StoreTransaction txh) throws BackendException {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather rename it to getSliceByBatch

final EntryArrayList result = new EntryArrayList();
entriesMap.entrySet().stream()
.limit(entriesNo)
.forEach(entry -> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use here collect(customCollector())

@kptfh kptfh force-pushed the feature/batch-reads branch from 79eac81 to 196d999 Compare September 25, 2019 13:13
@kptfh kptfh force-pushed the feature/batch-reads branch from 196d999 to 84ca1cf Compare September 25, 2019 13:28
@kptfh kptfh merged commit dceff4c into develop Sep 25, 2019
@kptfh kptfh deleted the feature/batch-reads branch September 25, 2019 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants