-
Notifications
You must be signed in to change notification settings - Fork 115
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
Restructure FNS global cache to be list #2036
Conversation
WalkthroughRecent updates to the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/streaming/full_node_streaming_manager.go (9 hunks)
Additional comments not posted (6)
protocol/streaming/full_node_streaming_manager.go (6)
72-77
: LGTM! Ensure new data structures are correctly initialized.The new list-based caches are correctly initialized.
142-153
: LGTM! Ensure mapping is correctly populated.The new mapping
clobPairIdToSubscriptionIdMapping
is correctly populated.
315-336
: LGTM! Ensure updates are correctly grouped and sent.The updates are correctly grouped by clob pair IDs and sent using the new list-based structure.
Line range hint
354-379
:
LGTM! Ensure fills are correctly grouped and sent.The fills are correctly grouped by clob pair IDs and sent using the new list-based structure.
Line range hint
383-397
:
LGTM! Ensure updates and subscription IDs are correctly added to the cache.The updates and subscription IDs are correctly added to the cache using the new list-based structure.
Line range hint
420-459
:
LGTM! Ensure updates and subscription IDs are correctly flushed.The updates and subscription IDs are correctly flushed using the new list-based structure.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- .github/workflows/protocol-build-and-push.yml (2 hunks)
Files skipped from review due to trivial changes (1)
- .github/workflows/protocol-build-and-push.yml
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- .github/workflows/protocol-build-and-push.yml (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- .github/workflows/protocol-build-and-push.yml
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/streaming/full_node_streaming_manager.go (9 hunks)
Additional comments not posted (6)
protocol/streaming/full_node_streaming_manager.go (6)
72-77
: Initialization of new data structures looks good.The constructor correctly initializes the new list-based data structures.
142-152
: Mapping population looks correct.The
clobPairIdToSubscriptionIdMapping
is correctly populated with subscription IDs.
314-335
: Correct usage of list-based structure for updates.The updates are correctly grouped and added to the cache using the new list-based structure.
Line range hint
353-378
:
Correct usage of list-based structure for fill updates.The fill updates are correctly grouped and added to the cache using the new list-based structure.
Line range hint
382-399
:
Correct addition of updates and subscription IDs to cache.The updates and subscription IDs are correctly added to the cache using the new list-based structure.
Line range hint
422-461
:
Correct handling of updates with new list-based structure.The updates are correctly collected and sent to subscribers using the new list-based structure.
// list of subscription ids for each stream update. | ||
streamUpdateSubscriptionCache [][]uint32 | ||
clobPairIdToSubscriptionIdMapping map[uint32][]uint32 | ||
numUpdatesInCache uint32 |
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.
prob no need for this field now that we have a central list, can use len(list)
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.
removed
streamUpdateCache []clobtypes.StreamUpdate | ||
// list of subscription ids for each stream update. | ||
streamUpdateSubscriptionCache [][]uint32 | ||
clobPairIdToSubscriptionIdMapping map[uint32][]uint32 |
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.
comment for these 2 new fields?
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.
done
} | ||
sm.clobPairIdToSubscriptionIdMapping[clobPairId] = append( | ||
sm.clobPairIdToSubscriptionIdMapping[clobPairId], | ||
sm.nextSubscriptionId, |
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 we evict stuff from this map when we prune order subscriptions from the fns manager?
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.
done, thanks for the catch!
@@ -295,27 +311,28 @@ func (sm *FullNodeStreamingManagerImpl) SendOrderbookUpdates( | |||
} | |||
|
|||
// Unmarshal each per-clob pair message to v1 updates. | |||
updatesByClobPairId := make(map[uint32][]clobtypes.StreamUpdate) | |||
updatesByClobPairId := make([]clobtypes.StreamUpdate, 0) |
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.
rename var since this is not a map anymore?
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.
done
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/streaming/full_node_streaming_manager.go (11 hunks)
Files skipped from review as they are similar to previous changes (1)
- protocol/streaming/full_node_streaming_manager.go
streamUpdateCache []clobtypes.StreamUpdate | ||
// list of subscription ids for each stream update. | ||
streamUpdateSubscriptionCache [][]uint32 |
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.
nit: cleaner to combine these two since they are used together and assumed to have same length etc
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.
added a TODO for now, will address in followup PR
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- .github/workflows/protocol-build-and-push.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- .github/workflows/protocol-build-and-push.yml
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- protocol/streaming/full_node_streaming_manager.go (11 hunks)
Files skipped from review as they are similar to previous changes (1)
- protocol/streaming/full_node_streaming_manager.go
Changelist
Restructure FNS global cache to be list
Test Plan
Tested in dev2
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit
wl/rm_global_cache
branch.