constants.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # this set must be kept complete, otherwise the RobustUnpacker might malfunction:
  2. ITEM_KEYS = set([b'path', b'source', b'rdev', b'chunks', b'hardlink_master',
  3. b'mode', b'user', b'group', b'uid', b'gid', b'mtime', b'atime', b'ctime',
  4. b'xattrs', b'bsdflags', b'acl_nfs4', b'acl_access', b'acl_default', b'acl_extended', ])
  5. ARCHIVE_TEXT_KEYS = (b'name', b'comment', b'hostname', b'username', b'time', b'time_end')
  6. ITEM_TEXT_KEYS = (b'path', b'source', b'user', b'group')
  7. # default umask, overriden by --umask, defaults to read/write only for owner
  8. UMASK_DEFAULT = 0o077
  9. CACHE_TAG_NAME = 'CACHEDIR.TAG'
  10. CACHE_TAG_CONTENTS = b'Signature: 8a477f597d28d172789f06886806bc55'
  11. # A large, but not unreasonably large segment size. Always less than 2 GiB (for legacy file systems). We choose
  12. # 500 MiB which means that no indirection from the inode is needed for typical Linux file systems.
  13. # Note that this is a soft-limit and can be exceeded (worst case) by a full maximum chunk size and some metadata
  14. # bytes. That's why it's 500 MiB instead of 512 MiB.
  15. DEFAULT_MAX_SEGMENT_SIZE = 500 * 1024 * 1024
  16. # A few hundred files per directory to go easy on filesystems which don't like too many files per dir (NTFS)
  17. DEFAULT_SEGMENTS_PER_DIR = 500
  18. CHUNK_MIN_EXP = 19 # 2**19 == 512kiB
  19. CHUNK_MAX_EXP = 23 # 2**23 == 8MiB
  20. HASH_WINDOW_SIZE = 0xfff # 4095B
  21. HASH_MASK_BITS = 21 # results in ~2MiB chunks statistically
  22. # defaults, use --chunker-params to override
  23. CHUNKER_PARAMS = (CHUNK_MIN_EXP, CHUNK_MAX_EXP, HASH_MASK_BITS, HASH_WINDOW_SIZE)
  24. # chunker params for the items metadata stream, finer granularity
  25. ITEMS_CHUNKER_PARAMS = (12, 16, 14, HASH_WINDOW_SIZE)
  26. # return codes returned by borg command
  27. # when borg is killed by signal N, rc = 128 + N
  28. EXIT_SUCCESS = 0 # everything done, no problems
  29. EXIT_WARNING = 1 # reached normal end of operation, but there were issues
  30. EXIT_ERROR = 2 # terminated abruptly, did not reach end of operation
  31. DASHES = '-' * 78
  32. PBKDF2_ITERATIONS = 100000