diff options
-rw-r--r-- | obnamlib/delegator.py | 7 | ||||
-rw-r--r-- | obnamlib/fmt_ga/client.py | 3 | ||||
-rw-r--r-- | obnamlib/plugins/backup_plugin.py | 4 | ||||
-rw-r--r-- | obnamlib/repo_interface.py | 8 |
4 files changed, 21 insertions, 1 deletions
diff --git a/obnamlib/delegator.py b/obnamlib/delegator.py index baad29fd..e5cf9b66 100644 --- a/obnamlib/delegator.py +++ b/obnamlib/delegator.py @@ -171,7 +171,12 @@ class RepositoryDelegator(obnamlib.RepositoryInterface): def _require_got_client_lock(self, client_name): if not self.got_client_lock(client_name): - raise obnamlib.RepositoryClientNotLocked() + raise obnamlib.RepositoryClientNotLocked(client_name=client_name) + + def flush_client(self, client_name): + self._require_got_client_lock(client_name) + client = self._lookup_client(client_name) + client.flush() def commit_client(self, client_name): self._require_got_client_lock(client_name) diff --git a/obnamlib/fmt_ga/client.py b/obnamlib/fmt_ga/client.py index d29c85a6..85417d04 100644 --- a/obnamlib/fmt_ga/client.py +++ b/obnamlib/fmt_ga/client.py @@ -74,6 +74,9 @@ class GAClient(object): def get_dirname(self): return self._dirname + def flush(self): + self._save_file_metadata() + def commit(self): self._load_data() self._finish_current_generation_if_any() diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py index e17d0c31..13334432 100644 --- a/obnamlib/plugins/backup_plugin.py +++ b/obnamlib/plugins/backup_plugin.py @@ -406,6 +406,10 @@ class BackupPlugin(obnamlib.ObnamPlugin): if e.errno in (errno.ENOSPC, errno.EPIPE): raise + if metadata.isdir() and not self.pretend: + self.repo.flush_client(self.client_name) + self.app.dump_memory_profile('after flushing client') + if self.checkpoint_manager.time_for_checkpoint(): self.make_checkpoint() self.progress.what(pathname) diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py index b3744de5..f948c68e 100644 --- a/obnamlib/repo_interface.py +++ b/obnamlib/repo_interface.py @@ -543,6 +543,14 @@ class RepositoryInterface(object): ''' raise NotImplementedError() + def flush_client(self, client_name): + '''Flush cached data from client. This is not a commit. + + This is a NOP, unless the a specific repository format gives + it meaning. + + ''' + def commit_client(self, client_name): '''Commit changes to client and DO NOT unlock it. |