pub struct Fabric { /* private fields */ }Expand description
Entry point for discovering and allocating fabric resources.
Fabric represents a connection to the fabric control plane. Use it
to discover available nodes and create resource allocation builders.
In WASM, the connection is managed by the host runtime. On native targets, the address is recorded for use in future host function implementations.
§Examples
use grafos_std::fabric::Fabric;
let fabric = Fabric::connect("10.10.0.11:5701")?;
// Access resource builders
let _mem = fabric.alloc_mem();
let _blk = fabric.alloc_block();
let _gpu = fabric.alloc_gpu();
let _cpu = fabric.alloc_cpu();Implementations§
Source§impl Fabric
impl Fabric
Sourcepub fn connect(addr: &str) -> Result<Fabric>
pub fn connect(addr: &str) -> Result<Fabric>
Connect to the fabric at the given address.
In WASM, the connection is managed by the host runtime — the address is passed through to the host. On native targets, this records the address for future use and always succeeds.
§Errors
Currently infallible. Will return crate::FabricError::Disconnected
once real connection logic is implemented.
Sourcepub fn nodes(&self) -> Vec<NodeInfo>
pub fn nodes(&self) -> Vec<NodeInfo>
Discover available nodes in the fabric.
Returns a list of NodeInfo structs for each discovered node.
Returns an empty list until the host provides a discovery function.
Sourcepub fn alloc_mem(&self) -> MemBuilder
pub fn alloc_mem(&self) -> MemBuilder
Start building a memory allocation request.
Returns a MemBuilder that can be configured with capacity
requirements before calling acquire.
Sourcepub fn alloc_block(&self) -> BlockBuilder
pub fn alloc_block(&self) -> BlockBuilder
Start building a block storage allocation request.
Returns a BlockBuilder that can be configured with capacity
requirements before calling acquire.
Sourcepub fn alloc_gpu(&self) -> GpuBuilder
pub fn alloc_gpu(&self) -> GpuBuilder
Start building a GPU allocation request.
Returns a GpuBuilder that can be configured with VRAM
requirements before calling acquire.
Sourcepub fn alloc_cpu(&self) -> CpuBuilder
pub fn alloc_cpu(&self) -> CpuBuilder
Start building a CPU allocation request.
Returns a CpuBuilder that can be configured with core count
and lease duration before calling acquire.