summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-10-25 23:11:42 +0200
committerLars Wirzenius <liw@liw.fi>2015-10-25 23:11:42 +0200
commitf92722707795f79b7b3d7d34a649cb7745c9889b (patch)
treeeaec6976c42dfea06d6728b9567feed4225b8abd
parent7c284793b342211f6320d60ef8a2e5a8e34345b2 (diff)
downloadobnam-liw/bagtree.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.py8
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