pub struct FunctionCtx { /* private fields */ }Expand description
The context one function invocation executes in: the pinned snapshot it reads, the write-set it accumulates, the rights it may exercise, and the collections it must be refused (zero-knowledge: the host holds ciphertext it provably cannot compute on — serving it to server-side code would break that promise).
Implementations§
Source§impl FunctionCtx
impl FunctionCtx
pub fn new( snapshot: RecordSnapshot, rights: CtxRights, denied: BTreeSet<String>, ) -> Self
Sourcepub fn with_pinned(
pinned: &PinnedRecords,
rights: CtxRights,
denied: BTreeSet<String>,
) -> Self
pub fn with_pinned( pinned: &PinnedRecords, rights: CtxRights, denied: BTreeSet<String>, ) -> Self
A context over an already-pinned snapshot: the records are shared, not copied, and their hash is reused.
Sourcepub fn snapshot_hash(&self) -> [u8; 32]
pub fn snapshot_hash(&self) -> [u8; 32]
Content hash of the pinned snapshot — bound into the run’s input_digest
so corroboration can only succeed between runs that saw the same data.
Sourcepub fn writes(&self) -> &BTreeMap<(String, String), Option<Vec<u8>>>
pub fn writes(&self) -> &BTreeMap<(String, String), Option<Vec<u8>>>
The buffered write-set in deterministic order (Some = put, None = delete).
Sourcepub fn writes_digest(&self) -> [u8; 32]
pub fn writes_digest(&self) -> [u8; 32]
Digest of the write-set — the second half of mutation corroboration (executors must agree on it, not just on the output).
Sourcepub fn write_bytes(&self) -> u64
pub fn write_bytes(&self) -> u64
Total key+value bytes the write-set will add to the store — what the caller bills as propagated transit when the writes replicate.
Trait Implementations§
Auto Trait Implementations§
impl Forget for FunctionCtx
impl Freeze for FunctionCtx
impl RefUnwindSafe for FunctionCtx
impl Send for FunctionCtx
impl Sync for FunctionCtx
impl Unpin for FunctionCtx
impl UnsafeUnpin for FunctionCtx
impl UnwindSafe for FunctionCtx
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more