Skip to main content

LocalKernel

Trait LocalKernel 

Source
pub trait LocalKernel {
    // Required methods
    fn put_object(&mut self, bytes: &[u8]) -> Result<ObjHash>;
    fn put_object_with_hash(
        &mut self,
        hash: ObjHash,
        bytes: &[u8],
    ) -> Result<()>;
    fn invoke(
        &mut self,
        root: ObjHash,
        endpoint: u32,
        args: [u64; 4],
        initial_gas: u64,
    ) -> Result<InvocationResult>;
    fn state_root(&self) -> ObjHash;
}
Expand description

In-process kernel: the personality’s object store + interpreter wiring, driven directly by the Nub Local backend.

One impl per personality. Replaces the historical hard-wired Backend::Local { Kernel<LocalArch>, CacheDirectory } pair.

Required Methods§

Source

fn put_object(&mut self, bytes: &[u8]) -> Result<ObjHash>

Decode + validate + content-hash bytes and insert the object into the store. Returns the personality-computed content hash. Idempotent re-puts follow the personality’s own semantics (JAVM: refcount bump).

Publication is permanent — a personality obligation that spans both backends (this method and the personality’s guest store alike): once a put succeeds for a hash, the store must retain that object for its own lifetime, never evicting it under capacity or memory pressure. The Hyperlight backend’s host-side idempotency cache (nub-host-kvm::MultiUseSandbox::published_blobs) short- circuits re-puts on exactly this assumption; a store that evicted a published object would take warm-path hits for objects the guest no longer holds, and later invokes would fail guest-side with object-not-found even though every publish returned Ok.

Source

fn put_object_with_hash(&mut self, hash: ObjHash, bytes: &[u8]) -> Result<()>

Pre-hashed variant of put_object: the caller already knows the content hash, letting the impl skip hashing on idempotent re-puts. Implementations may debug-assert the claimed hash.

Source

fn invoke( &mut self, root: ObjHash, endpoint: u32, args: [u64; 4], initial_gas: u64, ) -> Result<InvocationResult>

Invoke endpoint on the object graph rooted at root, overlaying args per the personality’s register ABI, bounded by initial_gas.

Source

fn state_root(&self) -> ObjHash

Content-addressed root of the current state (the personality defines what “root” means; JAVM: hash of the invoking Cap::Instance after the most recent invocation).

Implementors§