silk.trace.storage.
Pinned, preallocated storage for independently claimed recorder slots.
Import as Storage with import silk.trace.storage { Storage }.
Public declarations: 4.
Storage#
pub struct Storage<T>The owner prevents reallocation or release until every operation has finished.
Field length#
pub length: usizeImplementation Storage<T>#
impl<T: Copy> Storage<T>Associated function make#
pub effect fn make(count: usize, initial: T) -> Self ! OutOfMemoryError ? &mut AllocatorAllocates and initializes every cell before publishing the recorder.
Method at#
pub unsafe fn at(self: &Self, index: usize) -> *mut TThe caller owns the slot or accesses it only through atomics.
Slots#
pub struct Slots<T>A bounded set of cells. Independent atomic states protect disjoint payloads.
Implementation Slots<T>#
impl<T: Copy> Slots<T>Associated function make#
pub effect fn make(count: usize, initial: T) -> Self ! OutOfMemoryError ? &mut AllocatorAllocates all cells before observation starts.
Method length#
pub fn length(self: &Self) -> usizeThe configured number of slots.
Method claimAt#
pub fn claimAt(self: &Self, index: usize, from: u32, to: u32) -> boolClaims a single cell when its state still matches the caller's observation.
Method claim#
pub fn claim(self: &Self, first: usize, from: u32, to: u32) -> usizeAttempts one bounded sweep. Returns the capacity when no matching cell is available.
Method at#
pub unsafe fn at(self: &Self, index: usize) -> *mut TThe caller holds an exclusive claim for this index.
Method publish#
pub fn publish(self: &Self, index: usize, state: u32) -> ()Publishes the payload to a consumer or returns the cell to producers.
Buffers#
pub struct Buffers<T>A pool of producer buffers with release/acquire handoff of full and partial pages.
Implementation Buffers<T>#
impl<T: Copy> Buffers<T>Associated function make#
pub effect fn make(count: usize, width: usize, initial: T) -> Self ! OutOfMemoryError ? &mut AllocatorAllocates all page headers and all record slots.
Method length#
pub fn length(self: &Self) -> usizeThe maximum number of buffered records.
Method append#
pub fn append(self: &Self, hint: &mut usize, owner: usize, value: &T) -> boolAppends to the worker's partial page or acquires a fresh one. No thread waits for a peer.
Method take#
pub unsafe fn take(self: &Self, hint: *mut u64) -> Option<T>Drains ready pages before sealing a partial page. The next consumer can continue a page. The caller supplies a live atomic word for the entire call. All concurrent accesses to it must be atomic.
Pool#
pub struct Pool<T>A bounded open-record pool with a lock-free free stack for cross-thread returns.
Implementation Pool<T>#
impl<T: Copy> Pool<T>Associated function make#
pub effect fn make(capacity: usize, initial: T) -> Self ! OutOfMemoryError ? &mut AllocatorAllocates the records and links the available cells.
Method length#
pub fn length(self: &Self) -> usizeThe number of cells configured for open spans.
Method acquire#
pub fn acquire(self: &Self) -> usizePops an open cell. Exhaustion returns the capacity as an out-of-range index.
Method at#
pub unsafe fn at(self: &Self, index: usize) -> *mut TOnly the opener of this record may read or write it until release.
Method indexOf#
pub fn indexOf(self: &Self, address: u64) -> usizeResolves a stored machine address to a slot, rejecting addresses outside this pool or in the middle of a record. The address stays wide enough on 32-bit WebAssembly.
Method release#
pub fn release(self: &Self, index: usize) -> ()Releases a record even when its closing fiber runs on another worker.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2, x86_64-pc-windows-msvc, wasm64-unknown-unknown.