Fabric

Struct Fabric 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl Freeze for Fabric

§

impl RefUnwindSafe for Fabric

§

impl Send for Fabric

§

impl Sync for Fabric

§

impl Unpin for Fabric

§

impl UnwindSafe for Fabric

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.