1# this set must be kept complete, otherwise the RobustUnpacker might malfunction: 2ITEM_KEYS = frozenset(['path', 'source', 'rdev', 'chunks', 'chunks_healthy', 'hardlink_master', 3 'mode', 'user', 'group', 'uid', 'gid', 'mtime', 'atime', 'ctime', 'birthtime', 'size', 4 'xattrs', 'bsdflags', 'acl_nfs4', 'acl_access', 'acl_default', 'acl_extended', 5 'part']) 6 7# this is the set of keys that are always present in items: 8REQUIRED_ITEM_KEYS = frozenset(['path', 'mtime', ]) 9 10# this set must be kept complete, otherwise rebuild_manifest might malfunction: 11ARCHIVE_KEYS = frozenset(['version', 'name', 'items', 'cmdline', 'hostname', 'username', 'time', 'time_end', 12 'comment', 'chunker_params', 13 'recreate_cmdline', 14 'recreate_source_id', 'recreate_args', 'recreate_partial_chunks', # used in 1.1.0b1 .. b2 15 ]) 16 17# this is the set of keys that are always present in archives: 18REQUIRED_ARCHIVE_KEYS = frozenset(['version', 'name', 'items', 'cmdline', 'time', ]) 19 20# default umask, overridden by --umask, defaults to read/write only for owner 21UMASK_DEFAULT = 0o077 22 23# default file mode to store stdin data, defaults to read/write for owner and group 24# forcing to 0o100XXX later 25STDIN_MODE_DEFAULT = 0o660 26 27CACHE_TAG_NAME = 'CACHEDIR.TAG' 28CACHE_TAG_CONTENTS = b'Signature: 8a477f597d28d172789f06886806bc55' 29 30# A large, but not unreasonably large segment size. Always less than 2 GiB (for legacy file systems). We choose 31# 500 MiB which means that no indirection from the inode is needed for typical Linux file systems. 32# Note that this is a soft-limit and can be exceeded (worst case) by a full maximum chunk size and some metadata 33# bytes. That's why it's 500 MiB instead of 512 MiB. 34DEFAULT_MAX_SEGMENT_SIZE = 500 * 1024 * 1024 35 36# 20 MiB minus 41 bytes for a Repository header (because the "size" field in the Repository includes 37# the header, and the total size was set to 20 MiB). 38MAX_DATA_SIZE = 20971479 39 40# MAX_OBJECT_SIZE = <20 MiB (MAX_DATA_SIZE) + 41 bytes for a Repository PUT header, which consists of 41# a 1 byte tag ID, 4 byte CRC, 4 byte size and 32 bytes for the ID. 42MAX_OBJECT_SIZE = MAX_DATA_SIZE + 41 # see LoggedIO.put_header_fmt.size assertion in repository module 43assert MAX_OBJECT_SIZE == 20 * 1024 * 1024 44 45# repo config max_segment_size value must be below this limit to stay within uint32 offsets: 46MAX_SEGMENT_SIZE_LIMIT = 2 ** 32 - MAX_OBJECT_SIZE 47 48# borg.remote read() buffer size 49BUFSIZE = 10 * 1024 * 1024 50 51# to use a safe, limited unpacker, we need to set a upper limit to the archive count in the manifest. 52# this does not mean that you can always really reach that number, because it also needs to be less than 53# MAX_DATA_SIZE or it will trigger the check for that. 54MAX_ARCHIVES = 400000 55 56# repo.list() / .scan() result count limit the borg client uses 57LIST_SCAN_LIMIT = 100000 58 59DEFAULT_SEGMENTS_PER_DIR = 1000 60 61FD_MAX_AGE = 4 * 60 # 4 minutes 62 63CHUNK_MIN_EXP = 19 # 2**19 == 512kiB 64CHUNK_MAX_EXP = 23 # 2**23 == 8MiB 65HASH_WINDOW_SIZE = 0xfff # 4095B 66HASH_MASK_BITS = 21 # results in ~2MiB chunks statistically 67 68# defaults, use --chunker-params to override 69CHUNKER_PARAMS = (CHUNK_MIN_EXP, CHUNK_MAX_EXP, HASH_MASK_BITS, HASH_WINDOW_SIZE) 70 71# chunker params for the items metadata stream, finer granularity 72ITEMS_CHUNKER_PARAMS = (15, 19, 17, HASH_WINDOW_SIZE) 73 74# operating mode of the files cache (for fast skipping of unchanged files) 75DEFAULT_FILES_CACHE_MODE_UI = 'ctime,size,inode' 76DEFAULT_FILES_CACHE_MODE = 'cis' # == CacheMode(DEFAULT_FILES_CACHE_MODE_UI) 77 78# return codes returned by borg command 79# when borg is killed by signal N, rc = 128 + N 80EXIT_SUCCESS = 0 # everything done, no problems 81EXIT_WARNING = 1 # reached normal end of operation, but there were issues 82EXIT_ERROR = 2 # terminated abruptly, did not reach end of operation 83EXIT_SIGNAL_BASE = 128 # terminated due to signal, rc = 128 + sig_no 84 85# never use datetime.isoformat(), it is evil. always use one of these: 86# datetime.strftime(ISO_FORMAT) # output always includes .microseconds 87# datetime.strftime(ISO_FORMAT_NO_USECS) # output never includes microseconds 88ISO_FORMAT_NO_USECS = '%Y-%m-%dT%H:%M:%S' 89ISO_FORMAT = ISO_FORMAT_NO_USECS + '.%f' 90 91DASHES = '-' * 78 92 93PBKDF2_ITERATIONS = 100000 94 95 96REPOSITORY_README = """This is a Borg Backup repository. 97See https://borgbackup.readthedocs.io/ 98""" 99 100CACHE_README = """This is a Borg Backup cache. 101See https://borgbackup.readthedocs.io/ 102""" 103