summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-03-13 15:30:23 +0200
committerLars Wirzenius <liw@liw.fi>2016-03-13 15:52:23 +0200
commitbfe84dcb5dd5a8d54c43a61602920d50df11e178 (patch)
tree8bddd9874c8c76425bcce480df008928411ae553
parent41307f5a104c787544b7ffd5d3d515f48915b748 (diff)
downloadobnam-bfe84dcb5dd5a8d54c43a61602920d50df11e178.tar.gz
Use well-known blob, not raw object, in per-client
-rw-r--r--obnamlib/fmt_ga/client.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py
index a795b5dc..1bfe1dc1 100644
--- a/obnamlib/fmt_ga/client.py
+++ b/obnamlib/fmt_ga/client.py
@@ -25,6 +25,8 @@ import obnamlib
class GAClient(object):
+ _well_known_blob = 'root'
+
def __init__(self, client_name):
self._fs = None
self._dirname = None
@@ -101,8 +103,8 @@ class GAClient(object):
'generations': [g.as_dict() for g in self._generations],
}
blob = obnamlib.serialise_object(data)
- filename = self._get_filename()
- self._fs.overwrite_file(filename, blob)
+ blob_store = self._get_blob_store()
+ blob_store.put_well_known_blob(self._well_known_blob, blob)
def _load_data(self):
if not self._data_is_loaded:
@@ -112,9 +114,9 @@ class GAClient(object):
self._data_is_loaded = True
def _load_per_client_data(self):
- filename = self._get_filename()
- if self._fs.exists(filename):
- blob = self._fs.cat(filename)
+ blob_store = self._get_blob_store()
+ blob = blob_store.get_well_known_blob(self._well_known_blob)
+ if blob is not None:
data = obnamlib.deserialise_object(blob)
self._client_keys.set_from_dict(data['keys'])
for gen_dict in data['generations']:
@@ -122,9 +124,6 @@ class GAClient(object):
gen.set_from_dict(gen_dict)
self._generations.append(gen)
- def _get_filename(self):
- return os.path.join(self.get_dirname(), 'data.dat')
-
def _load_file_metadata(self):
blob_store = self._get_blob_store()
for gen in self._generations: