Expand description
Raw host function bindings for FBMU and FBBU.
This module provides the low-level interface between grafos-std and the
grafOS runtime. On wasm32 targets, these functions link to real host
imports (fabricbios_fbmu_v0 and fabricbios_fbbu_v0 WASM import
modules). On native targets, they delegate to mock implementations backed
by thread-local storage so unit tests work without a WASM runtime.
All unsafe in the crate is confined to this module. Higher-level code
in crate::mem and crate::block wraps these functions with safe
Rust APIs.
§Mock configuration (native targets only)
When running on non-WASM targets, the mock state can be configured for testing:
use grafos_std::host;
host::reset_mock();
host::mock_set_fbmu_arena_size(8192);
host::mock_set_fbbu_num_blocks(256);
host::mock_set_unix_time_secs(1_700_000_000);
// Now FabricMem::hello() and FabricBlock::hello() will use these values.Structs§
- Fbbu
Lease Info - Host-side FBBU lease metadata returned by v0 lease lifecycle calls.
- Fbmu
Lease Info - Host-side FBMU lease metadata returned by v0 lease lifecycle calls.
Constants§
- LEASE_
STATUS_ ACTIVE - Lease status code: lease is active.
- LEASE_
STATUS_ EXPIRED - Lease status code: lease has expired.
- LEASE_
STATUS_ REVOKED - Lease status code: lease was explicitly revoked/freed.
Functions§
- fbbu_
alloc - Allocate a block lease from FBBU with the requested minimum capacity and TTL.
- fbbu_
free - Free/revoke an FBBU lease.
- fbbu_
get_ num_ blocks - Query the total number of blocks available on the FBBU device.
- fbbu_
hello - Perform the FBBU HELLO handshake with the host.
- fbbu_
query - Query FBBU lease status and geometry metadata.
- fbbu_
read_ block - Read a single 512-byte block at the given logical block address.
- fbbu_
read_ block_ lease - Read a 512-byte block via FBBU using an explicit lease id.
- fbbu_
renew - Renew an FBBU lease and return the updated expiry timestamp.
- fbbu_
write_ block - Write a single 512-byte block at the given logical block address.
- fbbu_
write_ block_ lease - Write a 512-byte block via FBBU using an explicit lease id.
- fbmu_
alloc - Allocate a memory lease from FBMU with the requested minimum capacity and TTL.
- fbmu_
free - Free/revoke an FBMU lease.
- fbmu_
get_ arena_ size - Query the total FBMU arena size in bytes.
- fbmu_
hello - Perform the FBMU HELLO handshake with the host.
- fbmu_
query - Query FBMU lease status and capacity metadata.
- fbmu_
read - Read from the FBMU arena at
offsetintobuf. - fbmu_
read_ lease - Read from FBMU using an explicit lease id.
- fbmu_
renew - Renew an FBMU lease and return the updated expiry timestamp.
- fbmu_
write - Write
datato the FBMU arena at the given byteoffset. - fbmu_
write_ lease - Write to FBMU using an explicit lease id.
- gpu_
lease_ alloc - Allocate a GPU lease for the given resource. Returns an opaque lease_id on success.
- gpu_
lease_ free - Free/revoke a GPU lease.
- gpu_
lease_ query - Query the status of a GPU lease. Returns a status code (0=active, 1=expired, 2=revoked, 3=fenced).
- gpu_
lease_ renew - Renew an existing GPU lease.
- gpu_
session_ launch - Launch a kernel within a GPU session.
- gpu_
session_ mem_ alloc - Allocate device memory within a GPU session.
- gpu_
session_ mem_ free - Free device memory within a GPU session.
- gpu_
session_ mem_ read - Read data from device memory within a GPU session.
- gpu_
session_ mem_ write - Write data to device memory within a GPU session.
- gpu_
session_ module_ load - Load a GPU module within a GPU session.
- gpu_
session_ module_ unload - Unload a GPU module within a GPU session (Phase 48.16 SDK polish).
- gpu_
session_ sync - Synchronize a GPU session.
- mock_
advance_ time_ secs - Advance the mock unix time by
delta_secs. - mock_
set_ fbbu_ hello_ error - Inject an error into the mock FBBU HELLO handshake.
- mock_
set_ fbbu_ num_ blocks - Set the mock FBBU block count.
- mock_
set_ fbmu_ arena_ size - Set the mock FBMU arena size in bytes.
- mock_
set_ fbmu_ hello_ error - Inject an error into the mock FBMU HELLO handshake.
- mock_
set_ net_ hello_ error - Make mock net_hello return an error. Only available on native targets.
- mock_
set_ net_ interface - Configure the mock network interface name and bandwidth. Only available on native targets.
- mock_
set_ tasklet_ result - Configure the mock tasklet exit code and output. Only available on native targets.
- mock_
set_ tasklet_ submit_ error - Make mock tasklet_submit return an error. Only available on native targets.
- mock_
set_ unix_ time_ secs - Set the mock unix time used by lease lifecycle logic.
- net_
hello - Acquire a network interface with the given minimum bandwidth.
- reset_
mock - Reset all mock state to defaults.
- tasklet_
submit - Submit a WASM tasklet for execution on a fabric CPU resource.
- unix_
time_ secs - Return the current unix time in seconds used by lease lifecycle logic.