mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-22 07:43:06 +00:00
repo-create: write empty ChunkIndex to repo/cache/, docs
This commit is contained in:
parent
7f79b65e39
commit
4e576d51c7
2 changed files with 12 additions and 0 deletions
|
@ -69,6 +69,10 @@ def build_parser_repo_create(self, subparsers, common_parser, mid_common_parser)
|
|||
This command creates a new, empty repository. A repository is a ``borgstore`` store
|
||||
containing the deduplicated data from zero or more archives.
|
||||
|
||||
Repository creation can be quite slow for some kinds of stores (e.g. for ``sftp:``) -
|
||||
this is due to borgstore pre-creating all directories needed, making usage of the
|
||||
store faster.
|
||||
|
||||
Encryption mode TLDR
|
||||
++++++++++++++++++++
|
||||
|
||||
|
|
|
@ -181,6 +181,14 @@ def create(self):
|
|||
self.version = 3
|
||||
self.store.store("config/version", str(self.version).encode())
|
||||
self.store.store("config/id", bin_to_hex(os.urandom(32)).encode())
|
||||
# we know repo/data/ still does not have any chunks stored in it,
|
||||
# but for some stores, there might be a lot of empty directories and
|
||||
# listing them all might be rather slow, so we better cache an empty
|
||||
# ChunkIndex from here so that the first repo operation does not have
|
||||
# to build the ChunkIndex the slow way by listing all the directories.
|
||||
from borg.cache import write_chunkindex_to_repo_cache
|
||||
|
||||
write_chunkindex_to_repo_cache(self, ChunkIndex(), compact=True, clear=True, force_write=True)
|
||||
finally:
|
||||
self.store.close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue