-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add logpoller.FilteredLogs and support for filtering on subkey #1020
base: develop
Are you sure you want to change the base?
Conversation
cce7156
to
256f1c7
Compare
256f1c7
to
ce7cdc2
Compare
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.
Its a bit hard to review because it has all the changes from the filter PR, can you point this to improve-lp-codec-usage
It's all in a single commit, so I figured it wouldn't be too difficult to look at... probably should have linked to the commit directly instead of the PR: The Log Processing PR has been waiting for CODEOWNER approval since Thursday, not sure what the holdup is I was hoping it would be merged already. Otherwise I would have raised this against that branch instead of against develop. Hopefully will get merged quickly on Tues so I can just rebase onto develop. |
ce7cdc2
to
085dc88
Compare
pkg/solana/logpoller/parser.go
Outdated
@@ -22,6 +22,7 @@ const ( | |||
addressFieldName = "address" | |||
eventSigFieldName = "event_sig" | |||
defaultSort = "block_number ASC, log_index ASC" | |||
subKeysFieldName = "subkey_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.
This seems to be unused
pkg/solana/logpoller/parser.go
Outdated
} | ||
|
||
// Add 1 since postgresql arrays are 1-indexed. | ||
subkeyIdx := v.args.withIndexedField("subkey_index", p.SubkeyIndex+1) |
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.
should this be a constant?
pkg/solana/logpoller/parser.go
Outdated
|
||
comps := make([]string, len(p.ValueComparers)) | ||
for idx, comp := range p.ValueComparers { | ||
comps[idx], v.err = makeComp(comp, v.args, "subkey_value", subkeyIdx, "subkey_values[:%s] %s :%s") |
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.
I see this string pulled out above as a constant, but its unused
pkg/solana/logpoller/parser.go
Outdated
type eventBySubkeyFilter struct { | ||
SubkeyIndex uint64 |
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.
type eventBySubkeyFilter struct { | |
SubkeyIndex uint64 | |
type eventBySubKeyFilter struct { | |
SubKeyIndex uint64 |
pkg/solana/logpoller/parser.go
Outdated
} | ||
|
||
// Add 1 since postgresql arrays are 1-indexed. | ||
subkeyIdx := v.args.withIndexedField("subkey_index", p.SubkeyIndex+1) |
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.
subkeyIdx := v.args.withIndexedField("subkey_index", p.SubkeyIndex+1) | |
subKeyIdx := v.args.withIndexedField("subkey_index", p.SubKeyIndex+1) |
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.
Alright. There are a few dozen more places where it's subkey
or Subkey
, so I just went through and updated all of them.
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.
left some nit comments, but looks good otherwise
Quality Gate failedFailed conditions |
This adds
FilteredLogs
to logPoller.Service to complete the LogPoller API, as well as these functions and types in parser.go to support filtering events by subkeys:func NewEventBySubkeyFilter(subkeyIndex uint64, valueComparers []primitives.ValueComparator) (query.Expression, error)
func (v *pgDSLParser) VisitEventSubkeysByValueFilter(p *eventBySubkeyFilter)
type IndexedValueComparator
Also adds a test for filtering on subkeys to
parser_test.go
Supports: #1016