-
Notifications
You must be signed in to change notification settings - Fork 164
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
update indexstorage interface to reduce roundtrips #1838
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1838 +/- ##
==========================================
- Coverage 66.33% 66.30% -0.03%
==========================================
Files 92 92
Lines 9212 9213 +1
==========================================
- Hits 6111 6109 -2
- Misses 2354 2356 +2
- Partials 747 748 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
lgtm
pkg/api/index.go
Outdated
if err != nil { | ||
return handleRekorAPIError(params, http.StatusInternalServerError, fmt.Errorf("index storage error: %w", err), indexStorageUnexpectedResult) | ||
sha := strings.ToLower(util.PrefixSHA(params.Query.Hash)) | ||
if queryOperator == "or" { |
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.
Does "and" need to be handled too? I think the lookups would be the same for or vs and, it seems like NewCollection just processes them different I think
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.
It's handled in the else clause on line 52. The way the Collector was implemented is that you have to pass it in the queries for each input parameter separately, where as OR is just a concatenation.
pkg/indexstorage/redis/redis_test.go
Outdated
@@ -26,14 +26,14 @@ import ( | |||
) | |||
|
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.
Can we add a test to confirm read/write works with multiple values?
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.
The e2e tests already cover this
Signed-off-by: Bob Callaway <bcallaway@google.com>
6793729
to
e1902cb
Compare
This changes the interface for
indexstorage
in two ways:Shutdown()
method to clean up resources upon server shutdown[]string
on both read and write pathsThe redis implementation now pipelines requests into a single roundtrip between Rekor and Redis on both the read and write path (where possible).