The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Brackup::DigestCache - cache digests of file and chunk contents

DESCRIPTION

The Brackup DigestCache caches the digests (currently SHA1) of files and file chunks, to prevent untouched files from needing to be re-read on subsequent, iterative backups.

The digest cache is purely a cache. It has no important data in it, so don't worry about losing it. Worst case if you lose it: subsequent backups take longer while the digest cache is re-built.

DETAILS

File format

While designed to be abstract, the only supported digest cache format at the moment is an SQLite database, stored in a single file. The schema is created automatically as needed... no database maintenance is required.

File location

The SQLite file is stored in either the location specified in a Brackup::Root's [SOURCE] declaration in ~/.brackup.conf, as:

  [SOURCE:home]
  path = /home/bradfitz/
  # be explicit if you want:
  digestdb_file = /var/cache/brackup-brad/digest-cache-bradhome.db

Or, more commonly (and recommended), is to not specify it and accept the default location, which is ".brackup-digest.db" in the root's root directory.

  [SOURCE:home]
  path = /home/bradfitz/
  # this is the default:
  # digestdb_file = /home/bradfitz/.brackup-digest.db

SQLite Schema

This is made automatically for you, but if you want to look around in it, the schema is:

  CREATE TABLE digest_cache (
       key TEXT PRIMARY KEY,
       value TEXT
  )

Keys & Values stored in the cache

Files digests keys (see Brackup::File)

 [rootname]path/to/file.txt:<ctime>,<mtime>,<size>,<inodenum>

Chunk digests keys (see Brackup::PositionedChunk)

 [rootname]path/to/file.txt:<ctime>,<mtime>,<size>,<inodenum>;o=<offset>;l=<length>

Values

In either case, the values are the digest of the chunk/file, in form:

   sha1:e23c4b5f685e046e7cc50e30e378ab11391e528e

SEE ALSO

Brackup