Skip to content

buckethead.files.tracker

Track local filesystem paths against FileStore with an append-only version history. Construct one per BucketSQLite instance:

tracker = LocalFileTracker(bh.connection, bh.files)

Version metadata lives in two in-memory SQLite tables (bh_local_files for the current state, bh_local_file_versions for history) that snapshot and branch with the rest of the database. Content-hash deduping via FileStore means identical files across different paths or branches share one blob.

buckethead.files.tracker

LocalFileTracker: keep local filesystem paths in sync with FileStore blobs.

Maps each tracked absolute path to its current bh_key (the SHA-256 of contents, computed by FileStore). Every sync() that detects changed content appends a row to bh_local_file_versions — history is retained by default; retention rules plug in later against that history table.

See issue #36 for the planned generalization to arbitrary in-memory values via a user-supplied serializer.

LocalFileTracker

LocalFileTracker(conn: Connection, filestore: FileStore)
Source code in src/buckethead/files/tracker.py
def __init__(self, conn: sqlite3.Connection, filestore: FileStore) -> None:
    self._conn = conn
    self._filestore = filestore
    self._init_schema()