pub struct PagedMap<'a, T, Acum> {
    pub status: Item<'a, PaginationInfo<Acum>>,
    /* private fields */
}
Expand description

Allows for multi-transaction computation on a dataset. Required for large datasets due to gas constraints.

Fields§

§status: Item<'a, PaginationInfo<Acum>>

Pagination progress status

Implementations§

source§

impl<'a, T, Acum> PagedMap<'a, T, Acum>

source

pub const fn new(namespace: &'a str, status_namespace: &'a str) -> Self

source

pub fn instantiate(&self, store: &mut dyn Storage) -> Result<(), StdError>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn save( &self, store: &mut dyn Storage, key: &[u8], data: &T ) -> AbstractResult<()>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn unsafe_save( &self, store: &mut dyn Storage, key: &[u8], data: &T ) -> AbstractResult<()>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

Warning: This function circumvents the storage lock. You should only use this in a pagination function.

source

pub fn remove(&self, store: &mut dyn Storage, key: &[u8]) -> AbstractResult<T>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn unsafe_remove( &self, store: &mut dyn Storage, key: &[u8] ) -> AbstractResult<T>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

Warning: This function circumvents the storage lock. You should only use this in a pagination function. Returns the removed item after deleting it

source

pub fn load(&self, store: &dyn Storage, key: &[u8]) -> AbstractResult<T>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn has(&self, store: &dyn Storage, key: &[u8]) -> boolwhere T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn may_load( &self, store: &dyn Storage, key: &[u8] ) -> AbstractResult<Option<T>>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn load_status( &self, store: &dyn Storage ) -> AbstractResult<PaginationInfo<Acum>>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

source

pub fn key(&self, key: &[u8]) -> Path<T>where T: Serialize + DeserializeOwned,

source

pub fn page_with_accumulator<C, FuncResult>( &self, deps: DepsMut<'_>, limit: Option<u32>, context: &C, f: PaginationAccumulatorFunction<T, Acum, C, FuncResult> ) -> PaginationResult<Acum, Vec<FuncResult>>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

Perform some operation on a page of the map. Returns an optional result of that computation. Repeat until state unlocks to page over the whole map Omits errors from f()

source

pub fn page_without_accumulator<C, FuncResult>( &self, deps: DepsMut<'_>, limit: Option<u32>, context: &C, f: PaginationFunction<T, C, FuncResult> ) -> AbstractResult<Vec<FuncResult>>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,

Will apply function on each element (key, value) of the map. Errors on function f() are neglected. Will not lock the set as no accumulator is used so map state changes are allowed.

Auto Trait Implementations§

§

impl<'a, T, Acum> RefUnwindSafe for PagedMap<'a, T, Acum>where Acum: RefUnwindSafe, T: RefUnwindSafe,

§

impl<'a, T, Acum> Send for PagedMap<'a, T, Acum>where Acum: Send, T: Send,

§

impl<'a, T, Acum> Sync for PagedMap<'a, T, Acum>where Acum: Sync, T: Sync,

§

impl<'a, T, Acum> Unpin for PagedMap<'a, T, Acum>where Acum: Unpin, T: Unpin,

§

impl<'a, T, Acum> UnwindSafe for PagedMap<'a, T, Acum>where Acum: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.