Skip to content
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

Make the chain manager a View. #3135

Merged
merged 8 commits into from
Jan 15, 2025
Merged

Make the chain manager a View. #3135

merged 8 commits into from
Jan 15, 2025

Conversation

afck
Copy link
Contributor

@afck afck commented Jan 15, 2025

Motivation

Currently the chain manager is serialized as a whole and stored in a RegisterView in the chain state view. Since it contains blobs it can be very large, and the blobs are not needed every time the chain manager is loaded.

Proposal

Make the chain manager a View, and put the blobs in a MapView.

Test Plan

This doesn't change any logic, so CI should catch regressions. (In fact, it already did: #3133)

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Links

"""
A GraphQL-visible map item, complete with key.
"""
type Entry_BlobId_Blob_9f0b41f3 {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this weird suffix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's a hash to avoid type name collisions.

/// The owners that take over in fallback mode.
#[debug(skip_if = BTreeMap::is_empty)]
pub fallback_owners: BTreeMap<Owner, (PublicKey, u64)>,
pub fallback_owners: RegisterView<C, BTreeMap<Owner, (PublicKey, u64)>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a lot of mechanical work. I know it's not for this PR but it'd be nice if derive(View) wrapped all of the fields into propery *View variants.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if that's possible in general. E.g. some but not all maps should turn into MapViews.

Copy link
Contributor

Choose a reason for hiding this comment

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

sensible deafults + overrides with attributes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, maybe. Definitely out of scope for this PR, though. 😅

@afck afck merged commit 84ff425 into linera-io:main Jan 15, 2025
23 checks passed
@afck afck deleted the chain-manager-view branch January 15, 2025 11:21
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