pub struct CommonStorageHelper {
weak_write_blockers: RwLock<RangeBlockedList>,
strong_write_blockers: RwLock<RangeBlockedList>,
}
Expand description
Helper object for the StorageExt
implementation.
State such as write blockers needs to be kept somewhere, and instead of introducing a wrapper
(that might be bypassed), we store it directly in the Storage
objects so it
cannot be bypassed (at least when using the StorageExt
methods).
Fields§
§weak_write_blockers: RwLock<RangeBlockedList>
Current in-flight write that allow concurrent writes to the same region.
Normal non-async RwLock, so do not await while locked!
strong_write_blockers: RwLock<RangeBlockedList>
Current in-flight write that do not allow concurrent writes to the same region.
Implementations§
Source§impl CommonStorageHelper
impl CommonStorageHelper
Sourcepub async fn weak_write_blocker(
&self,
range: Range<u64>,
) -> RangeBlockedGuard<'_>
pub async fn weak_write_blocker( &self, range: Range<u64>, ) -> RangeBlockedGuard<'_>
Await concurrent strong write blockers for the given range.
Strong write blockers are set up for writes that must not be intersected by any other write. Await such intersecting concurrent write requests, and return a guard that will delay such new writes until the guard is dropped.
Sourcepub async fn strong_write_blocker(
&self,
range: Range<u64>,
) -> RangeBlockedGuard<'_>
pub async fn strong_write_blocker( &self, range: Range<u64>, ) -> RangeBlockedGuard<'_>
Await any concurrent write request for the given range.
Block the given range for any concurrent write requests until the returned guard object is dropped. Existing requests are awaited, and new ones will be delayed.