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 storage_page_size for the LegacyBackend configurable #1458

Merged
merged 1 commit into from Feb 29, 2024

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented Feb 29, 2024

Closes #1454 by allowing the user to configure the number of storage entries returned when iterating using the LegacyBackend. To make use of this you'll have to manually instantiate a backend etc, ie something like this:

// Connect to node:
let rpc_client = subxt::backend::rpc::RpcClient::from_insecure_url("ws://localhost:9944").await?;

// Use this connection to make calls using our legacy backend:
let backend = LegacyBackend::builder()
    .storage_page_size(1024)
    .build(rpc_client);

// Use the legacy backend to drive our Subxt client:
let client = OnlineClient::<PolkadotConfig>::from_backend(Arc::new(backend)).await?;

I added a builder just to mirror the UnstableBackend interface more closely, and to be a place where potentially we can expose more configuration if need be. It's definitely not ideal that you only have one global page size setting per client, but it's also a bit of a stop gap until we migrate to the new backend which streams storage entries and thus has no such configuration.

@jsdw jsdw marked this pull request as ready for review February 29, 2024 12:51
@jsdw jsdw requested a review from a team as a code owner February 29, 2024 12:51
Copy link
Contributor

@tadeohepperle tadeohepperle left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

@jsdw jsdw merged commit ddd0865 into master Feb 29, 2024
13 checks passed
@jsdw jsdw deleted the jsdw-configurable-storage-page-size branch February 29, 2024 13:13
@jsdw jsdw mentioned this pull request Feb 29, 2024
@jsdw jsdw mentioned this pull request Mar 21, 2024
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.

Speed-up account iteration
3 participants