Crate grafos_fs

Crate grafos_fs 

Source
Expand description

Distributed filesystem abstraction backed by leased block storage.

grafos-fs provides a practical filesystem subset (open, read, write, seek, readdir) on top of BlockLease storage obtained through the fabricBIOS data plane. Files larger than a configurable stripe threshold are automatically striped across multiple block leases for parallel I/O.

§On-block format

Block 0:           Superblock (magic "GFFS", version 1, layout offsets)
Blocks 1..B:       Free block bitmap (1 bit per block, packed)
Blocks B..I:       Inode table (fixed-size inode records)
Blocks I..N:       Data blocks

§Quick start

use grafos_fs::{FabricFs, OpenFlags};
use grafos_std::block::BlockBuilder;

let lease = BlockBuilder::new().min_blocks(2048).acquire()?;
let mut fs = FabricFs::format(vec![lease])?;

let mut fh = fs.create("/hello.txt")?;
fs.write(&mut fh, b"hello fabric")?;
fs.close(fh)?;

let fh = fs.open("/hello.txt", OpenFlags::Read)?;
let mut buf = [0u8; 12];
let n = fs.read(&fh, &mut buf)?;
assert_eq!(&buf[..n], b"hello fabric");

Structs§

DirEntry
Directory entry stored in directory data blocks.
FabricFs
Distributed filesystem backed by leased block storage.
FileHandle
Handle to an open file.
FileStat
File metadata returned by stat().

Enums§

OpenFlags
Flags for opening files.
SeekFrom
Position for seek operations.