borgbackup/borg

ideas for using the flags

Open

#8514 opened on Nov 1, 2024

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Python (10,086 stars) (732 forks)batch import
c: cachec: hashindexhelp wanted

Description

The ChunkIndex is a mapping 256bit key --> (32bit flags, 32bit size) since #8513.

The user flags are:

  • F_USED, meaning the chunk is referenced / used. this is used by borg compact to determine which chunks are used / which are not used (and then deleting the unused chunks from the repo).
  • F_COMPRESS, meaning the chunk shall get (re-)compressed, used by borg repo-compress.

The system flags are:

  • F_NEW, meaning the chunk was added after the last saving of the chunk index (flagging the chunks that need to be saved next)

Other flag bits are not used yet and available for creative usage.

Besides using these bits as flags/markers of some kind, we can also do memory-efficient (no additional memory use!) set operations, like e.g. to compute a set intersection:

  • set bit1 for members of set1
  • set bit2 for members of set2
  • intersection set1 & set2: iterate over all entries in the ChunkIndex, entries with both bits set are members of the intersection.

Collect any ideas what can be done with that below.

Contributor guide