Skip to main content

dazzle-preservelib

PyPI Release Date Python 3.9+ License: MIT Platform

Manifest + operations library -- the L3 orchestration layer of the DazzleLib stack.

It owns the preserve domain: the PreserveManifest (a content-hash record of what was copied, with DAG lineage), transactional copy / move / restore / verify operations, destination-conflict resolution, link-handling policy, and link-mirror reconciliation (linkmirror). It delegates the actual filesystem mechanics down the stack.

What this owns (and what it delegates)

Concern Layer
Manifest, operations, conflict resolution, link policy, verification dazzle-preservelib (L3, this lib)
File/link mechanics (create/detect/read/remove, copy, hash, metadata, disk-space) dazzle-filekit (L1)
UNC <-> drive identity unctools (L0)
Shared Protocols / TypedDicts / exception root dazzle-lib (B)
.dazzlelink record bridge (optional [dazzlelink] extra) dazzle-linklib (L2)

The orchestration and policy live here; the primitives they stand on belong to the layers below. This library is the destination of the P3 extraction that collapses three drifting preservelib copies (preserve, ghtraf, safedel) into one canonical home.

linkmirror -- reconcile links onto a mirrored tree

File-level mirrors (robocopy, Beyond Compare, preserve COPY) carry the files but frequently drop the links: symlinks and junctions vanish, hardlink groups arrive as independent duplicates. dazzle_preservelib.linkmirror is the mirror-scoped implementation of LinkHandlingMode.RECREATE (preserve#48 Phase 2, narrowed to the case that needs no lineage tracking: the destination already holds the copied files, so link identity is same relative path).

from dazzle_preservelib.linkmirror import (
    walk_scan, build_plan, apply_plan, verify_mirror,
)

manifest = walk_scan(r"D:\data")                # or mft.mft_scan (elevated, fast)
plan = build_plan(manifest, r"B:\data")         # diff against the mirror
result = apply_plan(plan, dry_run=False)        # additive-only: creates links,
                                                # restores link + parent times
report = verify_mirror(manifest, r"B:\data")    # byte/tick parity proof

Fidelity contract: targets are recreated verbatim (relative targets unresolved, intentionally-broken targets unrepaired, \\?\ forms kept) with the link's own timestamps at 100ns precision; existing destination entries are never modified (mismatches are reported as conflicts); re-runs are idempotent. Target rewriting (e.g. D:\ -> B:\ for drive retirement) is an explicit pluggable policy (make_prefix_rewrite_policy). Hardlink reconciliation is opt-in and sha256-guarded. The dz link-mirror tool (dazzlecmd) is the thin CLI over this engine.

Scanner backends: a portable os.scandir walk, and a Windows MFT/USN enumeration (linkmirror.mft, requires elevation) that inventories multi-million-record volumes in minutes -- field-proven mirroring 2,644 links off a failing 51M-record drive with nanosecond-identical timestamps and zero additional wear.

The stack

Layer Library Role
B dazzle-lib bedrock contracts
L0 unctools path identity
L1 dazzle-filekit filesystem primitives
L2 dazzle-linklib link record + resolver
L3 dazzle-preservelib (this) manifest + operations
dazzle-treelib traversal engine

Status

Functional (0.8.0 shipped the P3 extraction; 0.9.0 added linkmirror). The manifest + operations API is locked (see docs/api-stability.md); the preserve CLI consumes this library. The linkmirror package is provisional in 0.9.x (API may still refine; locks at 0.10). See the Roadmap.

Installation

pip install dazzle-preservelib

From source

git clone https://github.com/DazzleLib/dazzle-preservelib.git
cd dazzle-preservelib
pip install -e ".[dev]"

Development

python -m venv .venv
source .venv/bin/activate   # or .venv\Scripts\activate on Windows
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

# Install git hooks
bash scripts/install-hooks.sh

License

MIT. See LICENSE for details. The whole DazzleLib stack is MIT (STACK-MAP D11).

Download files

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

Source Distribution

dazzle_preservelib-0.9.0.tar.gz (120.9 kB view details)

Uploaded Source

Built Distribution

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

dazzle_preservelib-0.9.0-py3-none-any.whl (100.2 kB view details)

Uploaded Python 3

File details

Details for the file dazzle_preservelib-0.9.0.tar.gz.

File metadata

  • Download URL: dazzle_preservelib-0.9.0.tar.gz
  • Upload date:
  • Size: 120.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for dazzle_preservelib-0.9.0.tar.gz
Algorithm Hash digest
SHA256 05b6258ceca448f52f465738eb2caa47b25e9d78d155bb8e9fd8544fce3e2df0
MD5 74351645e6a9de9cc1337c9bfc170f0f
BLAKE2b-256 e9446dcdfc4871d6a61b251203266d33fb940a8e7ff3173ec7ddc1ef33a0a9cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for dazzle_preservelib-0.9.0.tar.gz:

Publisher: release.yml on DazzleLib/dazzle-preservelib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dazzle_preservelib-0.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dazzle_preservelib-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f4345ffd2ad2423bcfd6bae55ec9cb31f24962debf2809d845df9ee9f0d8118
MD5 0c0eef645cf76f48b85d0e3017185324
BLAKE2b-256 e8d2717fc68994d9f17793071d16f2e7d1023dc010aab71ddacd750a0368ca51

See more details on using hashes here.

Provenance

The following attestation bundles were made for dazzle_preservelib-0.9.0-py3-none-any.whl:

Publisher: release.yml on DazzleLib/dazzle-preservelib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 files

0.8.1

2 files

0.8.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page