Files
Hanzo Dev 6334500191 0.3.0: bazil.org/fuse mount + SQLite-on-FUSE e2e test (linux)
The mount layer is no longer a stub. With `-tags fuse` on Linux,
SQLite (and any POSIX consumer) opens files directly on the
mountpoint — no intermediate copy. Default builds stay
dependency-light: bazil.org/fuse + bazil.org/fuse/fs are gated
behind the build tag.

What's new
----------
- pkg/mount/fuse_unix.go (`-tags fuse && linux`): full FS/Node/Handle
  bridges. Maps every POSIX op the kernel sends:
    Read       → File.ReadAt
    Write      → File.WriteAt
    Fsync      → File.Sync         (durable through age + backend)
    Flush      → File.Sync         (close-time flush)
    Release    → File.Close
    Setattr.Size → File.Truncate
    Lookup     → FS.Lookup
    ReadDirAll → FS.ReadDir
    Create     → FS.Create + Open
    Mkdir      → FS.Mkdir
    Remove     → FS.Remove
    Open(O_TRUNC) → File.Truncate(0)
- pkg/mount/fuse_stub.go: same Mount/MountWithVFSAdapter signatures
  for the default no-fuse build; returns a build-tag error.
- pkg/mount/fuse_sqlite_test.go: gated by VFS_FUSE_E2E=1 +
  `-tags fuse`. Mounts in tempdir, creates `test.db`, 100 INSERTs,
  unmounts, remounts, runs PRAGMA integrity_check. Verifies the DB
  survives the full encrypt → backend → decrypt round trip with
  zero copy.
- cmd/vfs: mount subcommand wires through MountWithVFSAdapter.

CI
--
.github/workflows/build.yml runs three test passes on Ubuntu:
  1. default `go test -race ./...`
  2. `go vet -tags fuse ./...`
  3. apt-get fuse + `VFS_FUSE_E2E=1 go test -race -tags fuse
     -run TestFUSESQLite ./pkg/mount/ -v`

Caveats
-------
- macOS: bazil.org/fuse dropped macOS support upstream (commit
  65cc252). 0.3.1 will add a parallel mount_darwin.go using
  github.com/jacobsa/fuse so devs on macOS get the same e2e flow.
  Until then, macOS devs use the in-process API + the SQLite
  byte-roundtrip test in pkg/vfs/sqlite_test.go (already shipped).
- Local NVMe disk cache (write-back tier) lands in 0.4.0; today the
  cache is in-memory LRU.
2026-05-08 11:46:16 -07:00

44 lines
1.2 KiB
Makefile

SHELL := /usr/bin/env bash
VERSION := $(shell tr -d ' \n\r\t' < VERSION)
BIN := bin/vfs
.PHONY: help build test fmt vet check clean install image
.DEFAULT_GOAL := help
help: ## Show targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
build: ## Build vfs CLI
@mkdir -p bin
go build -ldflags "-X main.version=$(VERSION)" -o $(BIN) ./cmd/vfs
build-fuse: ## Build with FUSE mount support (Linux/macOS)
@mkdir -p bin
go build -tags=fuse -ldflags "-X main.version=$(VERSION)" -o $(BIN) ./cmd/vfs
test: ## Run unit tests
go test -race ./...
fmt: ## gofmt
gofmt -s -w .
vet: ## go vet
go vet ./...
check: fmt vet test ## fmt + vet + test
install: build ## Install to $GOBIN
go install -ldflags "-X main.version=$(VERSION)" ./cmd/vfs
clean: ## Clean build artifacts
rm -rf bin/ dist/
image: ## Build container image
docker build --build-arg VERSION=$(VERSION) -t ghcr.io/hanzoai/vfs:$(VERSION) .
test-fuse: ## Run FUSE end-to-end test (Linux only, requires kernel FUSE)
GOOS=linux go vet -tags fuse ./...
@echo "Cross-compile check passed. Run actual e2e on Linux:"
@echo " VFS_FUSE_E2E=1 go test -race -tags fuse -run TestFUSESQLite ./pkg/mount/ -v"