Module block

Module block 

Source
Expand description

Safe wrappers for FBBU (Fabric Bootstrap Binding Unit) host functions.

This module provides block-level fabric storage access through the FBBU data-plane protocol. All I/O operates on fixed 512-byte blocks addressed by logical block address (LBA).

§Usage

use grafos_std::block::{FabricBlock, BLOCK_SIZE};

let blk = FabricBlock::hello()?;
assert_eq!(blk.num_blocks(), 128);

let mut data = [0u8; BLOCK_SIZE];
data[0..5].copy_from_slice(b"hello");
blk.write_block(0, &data)?;

let readback = blk.read_block(0)?;
assert_eq!(&readback[0..5], b"hello");

For capacity-checked allocation, use BlockBuilder:

use grafos_std::block::BlockBuilder;

let lease = BlockBuilder::new().min_blocks(64).acquire()?;
assert!(lease.block().num_blocks() >= 64);

Structs§

BlockBuilder
Builder for acquiring a fabric block storage lease with capacity constraints.
BlockLease
A block storage lease that auto-frees on drop.
FabricBlock
Safe handle to fabric block storage via FBBU host functions.

Constants§

BLOCK_SIZE
Block size in bytes (512).