Struct abstract_core_testing::objects::paged_map::PagedMap
source · 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>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
pub fn save( &self, store: &mut dyn Storage, key: &[u8], data: &T ) -> AbstractResult<()>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
sourcepub fn unsafe_save(
&self,
store: &mut dyn Storage,
key: &[u8],
data: &T
) -> AbstractResult<()>where
T: Serialize + DeserializeOwned,
Acum: Serialize + DeserializeOwned + Default + Clone,
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.
pub fn remove(&self, store: &mut dyn Storage, key: &[u8]) -> AbstractResult<T>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
sourcepub fn unsafe_remove(
&self,
store: &mut dyn Storage,
key: &[u8]
) -> AbstractResult<T>where
T: Serialize + DeserializeOwned,
Acum: Serialize + DeserializeOwned + Default + Clone,
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
pub fn load(&self, store: &dyn Storage, key: &[u8]) -> AbstractResult<T>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
pub fn has(&self, store: &dyn Storage, key: &[u8]) -> boolwhere T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
pub fn may_load( &self, store: &dyn Storage, key: &[u8] ) -> AbstractResult<Option<T>>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
pub fn load_status( &self, store: &dyn Storage ) -> AbstractResult<PaginationInfo<Acum>>where T: Serialize + DeserializeOwned, Acum: Serialize + DeserializeOwned + Default + Clone,
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>>where
T: Serialize + DeserializeOwned,
Acum: Serialize + DeserializeOwned + Default + Clone,
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()
sourcepub 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,
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> 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