-
Notifications
You must be signed in to change notification settings - Fork 103
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
EventsQuery interface and LevelIndex enhancements. #625
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
==========================================
+ Coverage 98.57% 98.80% +0.22%
==========================================
Files 68 71 +3
Lines 8417 9011 +594
Branches 1227 1364 +137
==========================================
+ Hits 8297 8903 +606
+ Misses 114 100 -14
- Partials 6 8 +2 ☔ View full report in Codecov by Sentry. |
bd9f3ec
to
a5b19bd
Compare
7458c12
to
bff7098
Compare
I've updated this PR based on our discussions and the comments left. I've separated out the logic for choosing a paging strategy, we now have And for in-memory paging I've introduced the I'd like to have some discussion regarding typing for For throwing an error for an invalid |
…ray (#632) * Modified code such that in-memory-paging supports empty filter and array * Removed the need for FilterSelector
@thehenrytsai Great improvement for legibility I'll work on getting the tests up to par. Let's catch up today on the EventsQuery filter type, I have some ideas but want to get your input there. |
@thehenrytsai things to note: I wasn't sure about the intent wrt having For now I just made all of these properties return true if they are defined. Let me know if there are more nuanced intents you would like to see here. Original: private static isFilterConcise(filter: Filter, queryOptions: QueryOptions): boolean {
// if there is a specific recordId in the filter, return true immediately.
if (filter.recordId !== undefined) {
return true;
}
// unless a recordId is present, if there is a cursor we never use in memory paging
if (queryOptions.cursor !== undefined) {
return false;
}
// NOTE: remaining conditions will have cursor
if (filter.contextId !== undefined) {
return true;
}
if (filter.protocol !== undefined || filter.protocolPath !== undefined) {
return true;
}
if (filter.protocol !== undefined || filter.parentId === undefined) {
return true;
}
if (filter.protocol === undefined && filter.schema !== undefined) {
return true;
}
// all else
return false;
} Updated: private static isFilterConcise(filter: Filter, queryOptions: QueryOptions): boolean {
// if there is a specific recordId in the filter, return true immediately.
if (filter.recordId !== undefined) {
return true;
}
// unless a recordId is present, if there is a cursor we never use in memory paging
if (queryOptions.cursor !== undefined) {
return false;
}
// NOTE: remaining conditions will not have cursor
if (
filter.protocol !== undefined ||
filter.protocolPath !== undefined ||
filter.contextId !== undefined ||
filter.parentId !== undefined ||
filter.schema !== undefined
) {
return true;
}
// all else
return false;
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do it.
This PR contains a new interface method,
EventsQuery
, which is primarily used to query for filtered events in order to enable SelectiveSync.EventLogLevel:
EventLogLevel now takes an additional property
indexes
to it'sappend()
function. These indexes are key-value indexes in the same format that we use withe the MessageStore index.IndexLevel:
To enable this functionality
IndexLevel
has been enhanced to become a more general purpose LevelDB Index that supports sorting as well as a cursor pointer property.