diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-10-25 23:11:42 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-10-25 23:11:42 +0200 |
commit | f92722707795f79b7b3d7d34a649cb7745c9889b (patch) | |
tree | eaec6976c42dfea06d6728b9567feed4225b8abd | |
parent | 7c284793b342211f6320d60ef8a2e5a8e34345b2 (diff) | |
download | obnam-f92722707795f79b7b3d7d34a649cb7745c9889b.tar.gz |
Store bags in a directory hierachyliw/bagtree
Previously, they were all stored in one flat directory,
resulting in millions upon millions of files in one directory.
-rw-r--r-- | obnamlib/bag_store.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/obnamlib/bag_store.py b/obnamlib/bag_store.py index 5cbc3196..b5ab4dde 100644 --- a/obnamlib/bag_store.py +++ b/obnamlib/bag_store.py @@ -31,7 +31,13 @@ class BagStore(object): self._id_inventor.set_filename_maker(self._make_bag_filename) def _make_bag_filename(self, bag_id): - return os.path.join(self._dirname, '%016x.bag' % bag_id) + basename = '%016x' % bag_id + return os.path.join( + self._dirname, + basename[0:2], + basename[2:4], + basename[4:6], + '%s.bag' % basename) def set_location(self, fs, dirname): self._fs = fs |