Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Feature/partial translate #12700

Closed

Conversation

mrshiposha
Copy link
Contributor

This PR suggests adding new translate-like functions: partial_translate functions for StorageMap, StorageDoubleMap, and StorageNMap.

It will translate up to limit items from the given maybe_cursor position.

The maybe_cursor parameter behaves like the corresponding argument in the clear function.

Here is the documentation comment for the partial_translate:

/// Partially translate items from the map.
///
/// Returns the current cursor.
/// Once the resultant cursor is `None`, then no further items remain to be translated.
///
/// NOTE: After the initial call, it is important that no further items
/// are inserted into the map. If so, then the map may not be fully translated when the
/// resultant `maybe_cursor` is `None`.
///
/// # Limit
///
/// Maximum amount of items to migrate.
///
/// # Cursor
///
/// A *cursor* may be passed into this operation with `maybe_cursor`. `None` should only be
/// passed once (in the initial call).
/// Subsequent calls operating on the same map
/// should always pass `Some`, and this should be equal to the
/// previous call result's cursor.

@xlc
Copy link
Contributor

xlc commented Nov 14, 2022

I understand why we want this but this is a big footgun and hard to use it right...

@Dinonard
Copy link
Contributor

Dinonard commented Dec 6, 2022

Would be great to have this!
I started experimenting with something similar here AstarNetwork#2 and just noticed this PR exists.

Can we expect some more activity on this PR?

@stale
Copy link

stale bot commented Jan 6, 2023

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jan 6, 2023
@stale stale bot closed this Jan 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants