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

solana-account: add AccountSharedData::data_clone method #10

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

jstarry
Copy link
Contributor

@jstarry jstarry commented Feb 8, 2025

In order to create a lightweight view struct (anza-xyz/agave#4834) over vote account data without creating another copy of the data, I need to copy the internal Arc which is private.

@jstarry jstarry enabled auto-merge (squash) February 8, 2025 09:08
@jstarry jstarry disabled auto-merge February 8, 2025 09:08
@jstarry jstarry requested a review from joncinque February 8, 2025 09:22
Copy link
Collaborator

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

I looked for other patterns of cloning an internal Arc in a type to see if there's a standard way to name these kind of functions, but couldn't find anything in libraries like tokio / clap / std.

My one concern was that data_clone might make it sound like the underlying data is being cloned, but the return type should make that totally clear.

All in all, looks good!

@jstarry jstarry merged commit 59b5afd into anza-xyz:master Feb 10, 2025
20 checks passed
@jstarry jstarry deleted the feat/account-data-clone branch February 10, 2025 12:08
@Maliksb11

This comment was marked as spam.

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.

3 participants