CUBELinux-2: WordFlags/tri-channel 16-bit flag field, tag-14 + scan_by_word_flag, cubetrace capture→replay→golden→lineage, CUBE VP-tree balling index (cubecode::ballindex), cubefs-visible WordFlags, and cube-mvw (sharded multi-writer MVCC store with per-shard WALs + group-commit + compaction, impl CubeBackend => CubeStore<MvwBackend> DB). Adds show-flags/scan-word-flags/trace-*/golden-capture CLI; ~ tests green.

This commit is contained in:
CUBELinux-2
2026-09-06 21:20:04 -04:00
parent 3f007a1f38
commit cc896fc336
22 changed files with 1695 additions and 7 deletions
+2
View File
@@ -448,6 +448,8 @@ impl<B: CubeBackend + 'static> Filesystem for CubeFuse<B> {
kind: Kind::Directory,
size: 0,
mode: (mode & 0o7777) as u16,
word_flags: 0,
header_flags: 0,
uid: req.uid(),
gid: req.gid(),
created_at: 0,
+27 -4
View File
@@ -106,6 +106,10 @@ pub struct Attr {
pub created_at: u64,
/// Number of hard links: 1 for files, 2 for directories (`.` and `..`).
pub nlink: u32,
/// Per-word 16-bit flag field of the backing record (header tag 14). 0 for dirs.
pub word_flags: u16,
/// Per-record HeaderFlags of the backing record (header tag 12). 0 for dirs.
pub header_flags: u16,
}
/// The filesystem.
@@ -234,14 +238,14 @@ impl<B: CubeBackend> CubeFs<B> {
let kind = self.kind_of(p)?;
let coord = parsed.prefix_coord();
let acl = self.acl_of(coord);
let (size, created_at) = if kind == Kind::File {
let (size, created_at, word_flags, header_flags) = if kind == Kind::File {
let c = parsed.czyx().expect("file implies full coord");
match self.store.get_record(&c) {
Some((h, body)) => (body.len() as u64, h.created_at.unwrap_or(0)),
None => (0, 0),
Some((h, body)) => (body.len() as u64, h.created_at.unwrap_or(0), h.word_flags.bits(), h.flags.bits()),
None => (0, 0, 0, 0),
}
} else {
(0, 0)
(0, 0, 0, 0)
};
// Decision: directories report 0o755 unless an explicit ACL exists,
// because the file default (0644) would make every directory
@@ -262,6 +266,8 @@ impl<B: CubeBackend> CubeFs<B> {
gid: acl.gid,
created_at,
nlink: if kind == Kind::Directory { 2 } else { 1 },
word_flags,
header_flags,
})
}
@@ -771,6 +777,23 @@ mod tests {
assert!(f.read(p, 0, 1, 2000, 2000).is_ok());
}
#[test]
fn getattr_surfaces_word_flags_and_header_flags() {
use cubecoords::WordFlags;
let mut f = fs();
let mut h = CubeHeader::new();
h.doc_type = Some("fn".into());
h.word_flags = WordFlags::from_bits(
WordFlags::START_RECORD | WordFlags::END_RECORD | WordFlags::IS_HEADER | (0b10 << 6),
);
h.refresh_flags();
f.store_mut().put_record(cubecoords::Czyx::new(1, 1, 1, 1), &h, b"hi");
let a = f.getattr("/c001/z001/y001/x001").unwrap();
assert_eq!(a.word_flags & WordFlags::START_RECORD, WordFlags::START_RECORD);
assert_eq!((a.word_flags & WordFlags::TYPE_MASK) >> 6, 0b10, "type=code");
assert_eq!(a.header_flags & cubecoords::HeaderFlags::DOC_TYPE, cubecoords::HeaderFlags::DOC_TYPE);
}
#[test]
fn directories_default_to_traversable() {
let mut f = fs();