Skip to content

Custom field selection for wildcard - #419

Merged
DZakh merged 4 commits into
mainfrom
dz/custom-field-selection-for-wildcard
Jan 16, 2025
Merged

DZakh merged 4 commits into
mainfrom
dz/custom-field-selection-for-wildcard

Conversation

@DZakh

@DZakh DZakh commented Jan 16, 2025

Copy link
Copy Markdown
Member

This is the first step to having partitions for specific events. I've started with wildcard and the ability to include only needed fields in the query filed selection.

@DZakh
DZakh requested a review from JonoPrest January 16, 2025 07:19
Comment on lines +18 to +20
type selection =
| Wildcard({})
| Normal({})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is the point of payloads in these variant constructors?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So, they are objects and can be used as WeakMap keys.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In the next versions, they will also contain a list of specific events. You can see how it's done for wildcard in the next PR.

Comment on lines +147 to +149
preRegWildcardLogSelection
} else {
wildcardLogSelection

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is the difference between these two?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

preRegWildcardLogSelection filters out wildcard events which don't have preRegistration enabled

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh nvmnd, I see now 👍🏼

Comment on lines +33 to +36
contractAddressMapping: ContractAddressingMap.mapping,
//Used to prune dynamic contract registrations in the event
//of a rollback.
dynamicContracts: array<TablesStatic.DynamicContractRegistry.t>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you describe why you moved these items from what was "kind"? Do these values exist for wildcard partitions?

It's not a problem I just want to understand reasoning.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So it's not recreated and can be used as a cache key

Comment on lines +171 to +172
| ({selection: Wildcard(_)}, _)
| (_, {selection: Wildcard(_)}) => (p, Some(target))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So basically merge always fails with a wildcard partition?

Is there any problematic cases where it could - say - continuously try and merge partitions that can't be merged?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, there's no case when it creates a merge query for a partition.

@JonoPrest JonoPrest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome Dmitry, it looks good to me and nothing blocking, just a couple of comments.

If we can chat about the data structure of FetchState.selection before merging that would be great.

@DZakh
DZakh enabled auto-merge (squash) January 16, 2025 13:47
@DZakh
DZakh merged commit 6c61513 into main Jan 16, 2025
@DZakh
DZakh deleted the dz/custom-field-selection-for-wildcard branch January 16, 2025 13: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