summaryrefslogtreecommitdiff
path: root/obnamlib/repo_interface.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-05-16 18:27:24 +0300
committerLars Wirzenius <liw@liw.fi>2015-05-16 19:06:29 +0300
commit68e18a105bc9bca499895bf39bb5cffcf63d3dbf (patch)
tree979ef260d0691a92e4e90ffa6bdfc8e2bcefc940 /obnamlib/repo_interface.py
parent246bb669a27278ecb73e93c0e1b0ad0393a2e32f (diff)
downloadobnam-68e18a105bc9bca499895bf39bb5cffcf63d3dbf.tar.gz
Add RepositoryInterface.flush_chunks method
Diffstat (limited to 'obnamlib/repo_interface.py')
-rw-r--r--obnamlib/repo_interface.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/obnamlib/repo_interface.py b/obnamlib/repo_interface.py
index b39f8abe..540d1590 100644
--- a/obnamlib/repo_interface.py
+++ b/obnamlib/repo_interface.py
@@ -700,6 +700,10 @@ class RepositoryInterface(object):
'''Generate all chunk ids in repository.'''
raise NotImplementedError()
+ def flush_chunks(self):
+ '''Flush any pending chunks.'''
+ raise NotImplementedError()
+
def lock_chunk_indexes(self):
'''Locks chunk indexes for updates.'''
raise NotImplementedError()
@@ -1840,6 +1844,12 @@ class RepositoryInterfaceTests(unittest.TestCase): # pragma: no cover
def test_puts_chunk_into_repository(self):
chunk_id = self.repo.put_chunk_content('foochunk')
+ self.repo.flush_chunks()
+ self.assertTrue(self.repo.has_chunk(chunk_id))
+ self.assertEqual(self.repo.get_chunk_content(chunk_id), 'foochunk')
+
+ def test_finds_put_chunk_in_unflushed_repository(self):
+ chunk_id = self.repo.put_chunk_content('foochunk')
self.assertTrue(self.repo.has_chunk(chunk_id))
self.assertEqual(self.repo.get_chunk_content(chunk_id), 'foochunk')