The cubefs-mount --socket path was never actually built: CubeFs<B> is generic, so the --socket (DaemonBackend) and default (HashBackend) arms of the match were incompatible types (E0308), and --features mount failed to compile. The running binary was therefore the in-memory build, so --socket was silently ignored and every FUSE write went to RAM and never reached the daemon (rawget/rawkeys returned none / 0 keys, WAL stayed 0). Fix: type-erase the backend. Add (forwards to inner) in cubestore, and build in cubefs-mount via Box::new(DaemonBackend::new(p)) / Box::new(HashBackend::new()). Keeps cubefs free of a cubesys dep (acyclic graph). Verified end-to-end on host (shared code path as the VM): a FUSE write via lands in the daemon store (rawget returns the record, 5 keys present, WAL grows), and survives a of the daemon + relaunch with the same --store (byte-identical read-back). Also includes (from RESUME-cubefs-daemon.md): cubesys raw* command family (rawget/rawput/rawdel/rawkeys/rawscan + parse/hex helpers) and the DaemonBackend client + smoke tests. Report/verification docs added. Note: VM cubefs.service still mounts in-memory (no --socket); update the unit to as a follow-up so the deployed VM FUSE is durable too.
54 lines
2.3 KiB
Rust
54 lines
2.3 KiB
Rust
//! CUBELinux-2 Package 3 — `cubefs`: a POSIX namespace over CZYX.
|
|
//!
|
|
//! Built NEW from the PDF spec (Package 3, p. "cubefs (filesystem or virtual
|
|
//! FS)"). Not recycled from the prior `/home/CUBELinux` build, which had no
|
|
//! filesystem layer at all.
|
|
//!
|
|
//! # What the PDF asks for
|
|
//!
|
|
//! > Map C/Z/Y/X ranges to top-level directories (C), subdirs (Z,Y) and files
|
|
//! > (X), or keep the 4-D API but expose FUSE hooks for POSIX compatibility.
|
|
//! > Use Null cubes/rows for: ACLs, extended attributes, journaling, volume
|
|
//! > metadata.
|
|
//!
|
|
//! # Structure of this crate
|
|
//!
|
|
//! * [`path`] — the pure, dependency-free bijection between POSIX paths and
|
|
//! [`Czyx`] coordinates. This is the part that must be provably correct, so
|
|
//! it is testable without a kernel mount.
|
|
//! * [`nullspace`] — the Null-cube control plane: ACLs, xattrs, the journal,
|
|
//! and volume metadata, each pinned to a documented `C=0` sub-cube.
|
|
//! * [`vfs`] — the backend-agnostic filesystem operations (lookup, readdir,
|
|
//! read, write, getattr, xattr, ACL check) expressed over a [`CubeStore`].
|
|
//! * `fuse` (feature `mount`) — the thin adapter that translates kernel FUSE
|
|
//! calls into [`vfs`] calls. Feature-gated so the logic above builds and
|
|
//! tests anywhere.
|
|
//!
|
|
//! # Decision: why a bijection and not an inode table
|
|
//!
|
|
//! A conventional FUSE filesystem allocates opaque inode numbers and keeps a
|
|
//! side table mapping inode -> object. CUBELinux's whole premise is that the
|
|
//! coordinate *is* the address, so allocating a second, unrelated identifier
|
|
//! space would reintroduce exactly the indirection the design removes.
|
|
//! Instead the inode number IS the packed `u32` coordinate (widened to u64),
|
|
//! so `ino <-> Czyx` is total, stateless, and needs no table. The FUSE root
|
|
//! inode is required by the kernel to be 1, and `Czyx::unpack_u32(1)` is
|
|
//! `(0,0,0,1)` — a Null cube, never a user record — so the reservation costs
|
|
//! us no addressable user space. See [`path::ino_to_czyx`].
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![warn(missing_docs)]
|
|
|
|
pub mod backend;
|
|
pub mod nullspace;
|
|
pub mod path;
|
|
pub mod vfs;
|
|
|
|
#[cfg(feature = "mount")]
|
|
pub mod fuse;
|
|
|
|
pub use backend::DaemonBackend;
|
|
pub use nullspace::{Acl, JournalEntry, JournalOp, NullSpace, VolumeMeta};
|
|
pub use path::{czyx_to_ino, ino_to_czyx, parse_path, render_path, PathError, ROOT_INO};
|
|
pub use vfs::{Attr, CubeFs, FsError, Kind};
|