Skip to main content

ZFS-backed ONTAP-shaped storage backend for nessie-store — PyO3 bindings.

Project description

nessie-backend-zfs

The ZFS-backed storage backend for nessie-store — the VolumeBackend ⊂ SnapshotBackend ⊂ CloneBackend stack mapped onto zfs/zpool/exportfs. Volumes are datasets, snapshots are zfs snapshot, FlexClones are zfs clone, and the data plane is an NFS export. Every command goes through a CommandRunner seam, so it is exact and testable.

Install

pip install nessie-backend-zfs      # Python
cargo add nessie-backend-zfs        # Rust

Usage (Python)

Two extension points. Outside — drive real ZFS (needs zfs/zpool + privilege):

from nessie_backend_zfs import ZfsBackend

b = ZfsBackend(pool="ontap-sim", data_lif="192.168.1.100")
vol = b.create_volume("build-cache", size_bytes=10 * 2**30)
snap = b.create_snapshot(vol["uuid"], "pre-build")
clone = b.create_clone(vol["uuid"], snap["uuid"], "build-cache-pr1234")
print(b.access_handle(vol["uuid"]))   # {'kind': 'nfs_export', 'server': ..., 'path': ...}

Inside — pass a runner(argv) -> {"success", "stdout", "stderr"} callable and every command is routed through your function. Mock it for tests, audit it, or wrap it in sudo:

from nessie_backend_zfs import ZfsBackend

def runner(argv):
    print("nessie ran:", " ".join(argv))      # audit every command
    return {"success": True, "stdout": "", "stderr": ""}

b = ZfsBackend(pool="tank", runner=runner)
vol = b.create_volume("vol1", size_bytes=1 << 30)   # prints: nessie ran: zfs create -o quota=...

Methods return plain dicts in the substrate-neutral domain shape and raise NessieError on failure.

Usage (Rust)

use nessie_backend_core::{VolumeBackend, VolumeSpec};
use nessie_backend_zfs::{SystemRunner, ZfsBackend, ZfsConfig};

let cfg = ZfsConfig { pool: "ontap-sim".into(), ..ZfsConfig::default() };
let b = ZfsBackend::new(SystemRunner, cfg);
let vol = b.create_volume(VolumeSpec::named("build-cache")).unwrap();

The CommandRunner trait is the same seam the Python runner rides on — swap SystemRunner for a mock to assert the exact argv in unit tests.

Dual-licensed MIT OR Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nessie_backend_zfs-0.2.0-cp312-cp312-manylinux_2_39_x86_64.whl (377.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

File details

Details for the file nessie_backend_zfs-0.2.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for nessie_backend_zfs-0.2.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ea6202636391361f0fd372609e8ea3a08d7cbac8d2d7b1b6c67eecfd40500ca5
MD5 4e28bdb616761bf0ec41441e187908ae
BLAKE2b-256 b3e1cb0b62cd510cf192155e24ea3fd4a73fa14dfffcba0d101dc1396f74dc06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page