combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit d867cd1bc3cc0bd83d3e6727375f7f7fe689e379
parent 8a4b1a452d96effb493b8027520bb95bb87db3fd
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Wed,  1 Apr 2015 15:56:51 -0400

renamed dict names in combox.silo.ComboxSilo from shard_* -> file_*

The main zarking reason for the name is that we might also want to
track directories apart from shards in the node directories.

  modified:   combox/silo.py
  modified:   tests/silo_test.py

Diffstat:
combox/silo.py | 8++++----
tests/silo_test.py | 102++++++++++++++++++++++++++++++++++++++++----------------------------------------
2 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/combox/silo.py b/combox/silo.py @@ -40,8 +40,8 @@ class ComboxSilo(object): self.db = pickledb.load(self.silo_path, True) ## things we need for housekeep the node directory. - self.node_dicts = ['shard_created', 'shard_modified', 'shard_moved', - 'shard_deleted'] + self.node_dicts = ['file_created', 'file_modified', 'file_moved', + 'file_deleted'] # created the dicts if not already created. for ndict in self.node_dicts: @@ -147,7 +147,7 @@ class ComboxSilo(object): """ Update information about the shard of `file_'. - type_: 'shard_created', 'shard_modified', 'shard_moved', 'shard_deleted' + type_: 'file_created', 'file_modified', 'file_moved', 'file_deleted' file_: path of the file_ in combox directory. """ @@ -166,7 +166,7 @@ class ComboxSilo(object): """ Returns a number denoting the number of node directories in which the file_'s shard was created/modified/moved/deleted. - type_: 'shard_created', 'shard_modified', 'shard_moved', 'shard_deleted' + type_: 'file_created', 'file_modified', 'file_moved', 'file_deleted' file_: path of the file_ in combox directory. """ self.reload() diff --git a/tests/silo_test.py b/tests/silo_test.py @@ -105,97 +105,97 @@ class TestSilo(object): silo = ComboxSilo(self.config, self.silo_lock) keys = silo.db.db.keys() - node_dicts = ['shard_created', 'shard_modified', 'shard_moved', - 'shard_deleted'] + node_dicts = ['file_created', 'file_modified', 'file_moved', + 'file_deleted'] for ndict in node_dicts: assert ndict in keys def test_csilo_nodset_create(self): - """Tests node_set method, in ComboxSilo class, when type is 'shard_created'. + """Tests node_set method, in ComboxSilo class, when type is 'file_created'. """ silo = ComboxSilo(self.config, self.silo_lock) - silo.node_set('shard_created', self.LOREM) - silo.node_set('shard_created', self.LOREM) - silo.node_set('shard_created', self.LOREM) + silo.node_set('file_created', self.LOREM) + silo.node_set('file_created', self.LOREM) + silo.node_set('file_created', self.LOREM) - silo.node_set('shard_created', self.IPSUM) - silo.node_set('shard_created', self.IPSUM) - silo.node_set('shard_created', self.IPSUM) - silo.node_set('shard_created', self.IPSUM) + silo.node_set('file_created', self.IPSUM) + silo.node_set('file_created', self.IPSUM) + silo.node_set('file_created', self.IPSUM) + silo.node_set('file_created', self.IPSUM) - dict_shard_created = silo.db.get('shard_created') - assert_equal(3, dict_shard_created[self.LOREM]) - assert_equal(4, dict_shard_created[self.IPSUM]) + dict_file_created = silo.db.get('file_created') + assert_equal(3, dict_file_created[self.LOREM]) + assert_equal(4, dict_file_created[self.IPSUM]) def test_csilo_nodset_modified(self): - """Tests node_set method, in ComboxSilo class, when type is 'shard_modified'. + """Tests node_set method, in ComboxSilo class, when type is 'file_modified'. """ silo = ComboxSilo(self.config, self.silo_lock) - silo.node_set('shard_modified', self.LOREM) - silo.node_set('shard_modified', self.LOREM) - silo.node_set('shard_modified', self.LOREM) + silo.node_set('file_modified', self.LOREM) + silo.node_set('file_modified', self.LOREM) + silo.node_set('file_modified', self.LOREM) - silo.node_set('shard_modified', self.IPSUM) - silo.node_set('shard_modified', self.IPSUM) - silo.node_set('shard_modified', self.IPSUM) - silo.node_set('shard_modified', self.IPSUM) + silo.node_set('file_modified', self.IPSUM) + silo.node_set('file_modified', self.IPSUM) + silo.node_set('file_modified', self.IPSUM) + silo.node_set('file_modified', self.IPSUM) - dict_shard_modified = silo.db.get('shard_modified') - assert_equal(3, dict_shard_modified[self.LOREM]) - assert_equal(4, dict_shard_modified[self.IPSUM]) + dict_file_modified = silo.db.get('file_modified') + assert_equal(3, dict_file_modified[self.LOREM]) + assert_equal(4, dict_file_modified[self.IPSUM]) def test_csilo_nodset_moved(self): - """Tests node_set method, in ComboxSilo class, when type is 'shard_moved'. + """Tests node_set method, in ComboxSilo class, when type is 'file_moved'. """ silo = ComboxSilo(self.config, self.silo_lock) - silo.node_set('shard_moved', self.LOREM) - silo.node_set('shard_moved', self.LOREM) - silo.node_set('shard_moved', self.LOREM) + silo.node_set('file_moved', self.LOREM) + silo.node_set('file_moved', self.LOREM) + silo.node_set('file_moved', self.LOREM) - silo.node_set('shard_moved', self.IPSUM) - silo.node_set('shard_moved', self.IPSUM) - silo.node_set('shard_moved', self.IPSUM) - silo.node_set('shard_moved', self.IPSUM) + silo.node_set('file_moved', self.IPSUM) + silo.node_set('file_moved', self.IPSUM) + silo.node_set('file_moved', self.IPSUM) + silo.node_set('file_moved', self.IPSUM) - dict_shard_moved = silo.db.get('shard_moved') - assert_equal(3, dict_shard_moved[self.LOREM]) - assert_equal(4, dict_shard_moved[self.IPSUM]) + dict_file_moved = silo.db.get('file_moved') + assert_equal(3, dict_file_moved[self.LOREM]) + assert_equal(4, dict_file_moved[self.IPSUM]) - def test_csilo_nodset_shard_deleted(self): - """Tests node_set method in ComboxSilo class, when type is 'shard_deleted'. + def test_csilo_nodset_file_deleted(self): + """Tests node_set method in ComboxSilo class, when type is 'file_deleted'. """ silo = ComboxSilo(self.config, self.silo_lock) - silo.node_set('shard_deleted', self.LOREM) - silo.node_set('shard_deleted', self.LOREM) - silo.node_set('shard_deleted', self.LOREM) + silo.node_set('file_deleted', self.LOREM) + silo.node_set('file_deleted', self.LOREM) + silo.node_set('file_deleted', self.LOREM) - silo.node_set('shard_deleted', self.IPSUM) - silo.node_set('shard_deleted', self.IPSUM) - silo.node_set('shard_deleted', self.IPSUM) - silo.node_set('shard_deleted', self.IPSUM) + silo.node_set('file_deleted', self.IPSUM) + silo.node_set('file_deleted', self.IPSUM) + silo.node_set('file_deleted', self.IPSUM) + silo.node_set('file_deleted', self.IPSUM) - dict_shard_deleted = silo.db.get('shard_deleted') - assert_equal(3, dict_shard_deleted[self.LOREM]) - assert_equal(4, dict_shard_deleted[self.IPSUM]) + dict_file_deleted = silo.db.get('file_deleted') + assert_equal(3, dict_file_deleted[self.LOREM]) + assert_equal(4, dict_file_deleted[self.IPSUM]) def test_csilo_nodeget(self): """Tests node_get method in ComboxSilo class """ silo = ComboxSilo(self.config, self.silo_lock) - assert_equal(None, silo.node_get('shard_created', self.LOREM)) + assert_equal(None, silo.node_get('file_created', self.LOREM)) - silo.node_set('shard_created', self.LOREM) - silo.node_set('shard_created', self.LOREM) - assert_equal(2, silo.node_get('shard_created', self.LOREM)) + silo.node_set('file_created', self.LOREM) + silo.node_set('file_created', self.LOREM) + assert_equal(2, silo.node_get('file_created', self.LOREM)) def teardown(self):