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>
impl<'a, T, Acum> PagedMap<'a, T, Acum>
pub const fn new(namespace: &'a str, status_namespace: &'a str) -> Self
pub fn instantiate(&self, store: &mut dyn Storage) -> Result<(), StdError>
pub fn save( &self, store: &mut dyn Storage, key: &[u8], data: &T, ) -> AbstractResult<()>
Sourcepub fn unsafe_save(
&self,
store: &mut dyn Storage,
key: &[u8],
data: &T,
) -> AbstractResult<()>
pub fn unsafe_save( &self, store: &mut dyn Storage, key: &[u8], data: &T, ) -> AbstractResult<()>
Warning: This function circumvents the storage lock. You should only use this in a pagination function.
pub fn remove(&self, store: &mut dyn Storage, key: &[u8]) -> AbstractResult<T>
Sourcepub fn unsafe_remove(
&self,
store: &mut dyn Storage,
key: &[u8],
) -> AbstractResult<T>
pub fn unsafe_remove( &self, store: &mut dyn Storage, key: &[u8], ) -> AbstractResult<T>
Warning: This function circumvents the storage lock. You should only use this in a pagination function. Returns the removed item after deleting it
pub fn load(&self, store: &dyn Storage, key: &[u8]) -> AbstractResult<T>
pub fn has(&self, store: &dyn Storage, key: &[u8]) -> bool
pub fn may_load( &self, store: &dyn Storage, key: &[u8], ) -> AbstractResult<Option<T>>
pub fn load_status( &self, store: &dyn Storage, ) -> AbstractResult<PaginationInfo<Acum>>
pub fn key(&self, key: &[u8]) -> Path<T>where
T: Serialize + DeserializeOwned,
Sourcepub fn page_with_accumulator<C, FuncResult>(
&self,
deps: DepsMut<'_>,
limit: Option<u32>,
context: &C,
f: PaginationAccumulatorFunction<T, Acum, C, FuncResult>,
) -> PaginationResult<Acum, Vec<FuncResult>>
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>>
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()
Sourcepub fn page_without_accumulator<C, FuncResult>(
&self,
deps: DepsMut<'_>,
limit: Option<u32>,
context: &C,
f: PaginationFunction<T, C, FuncResult>,
) -> AbstractResult<Vec<FuncResult>>
pub fn page_without_accumulator<C, FuncResult>( &self, deps: DepsMut<'_>, limit: Option<u32>, context: &C, f: PaginationFunction<T, C, FuncResult>, ) -> AbstractResult<Vec<FuncResult>>
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> Freeze for PagedMap<'a, T, Acum>
impl<'a, T, Acum> RefUnwindSafe for PagedMap<'a, T, Acum>where
T: RefUnwindSafe,
Acum: RefUnwindSafe,
impl<'a, T, Acum> Send for PagedMap<'a, T, Acum>
impl<'a, T, Acum> Sync for PagedMap<'a, T, Acum>
impl<'a, T, Acum> Unpin for PagedMap<'a, T, Acum>
impl<'a, T, Acum> UnwindSafe for PagedMap<'a, T, Acum>where
T: UnwindSafe,
Acum: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more