summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-04-08 17:18:33 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-04-08 17:18:33 -0400
commitf15ce63ba11ad101349ee51a0baa4109400d7329 (patch)
tree7f94507471009cf0a042ba575870468c753e493f
parentf64e56864dcd316ab1e74b2f5b2ec9462cd1e368 (diff)
After a file which was created a in a remote computer is reconstructed in this computer, its info is removed from the 'file_created' dictionary in the silo.
modified: combox/events.py modified: tests/events_test.py
-rw-r--r--combox/events.py2
-rw-r--r--tests/events_test.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/combox/events.py b/combox/events.py
index efdbc53..609ed8e 100644
--- a/combox/events.py
+++ b/combox/events.py
@@ -311,6 +311,7 @@ class NodeDirMonitor(LoggingEventHandler):
if num == self.num_nodes:
os.mkdir(file_cb_path)
+ self.silo.node_rem('file_created', file_cb_path)
elif (not event.is_directory) and (not path.exists(file_cb_path)):
# shard created.
@@ -324,6 +325,7 @@ class NodeDirMonitor(LoggingEventHandler):
decrypt_and_glue(file_cb_path, self.config)
# update db.
self.silo.update(file_cb_path)
+ self.silo.node_rem('file_created', file_cb_path)
def on_deleted(self, event):
diff --git a/tests/events_test.py b/tests/events_test.py
index fa0187c..a0001b5 100644
--- a/tests/events_test.py
+++ b/tests/events_test.py
@@ -274,6 +274,8 @@ class TestEvents(object):
assert fmutant_content == read_file(self.TEST_FILE_MUTANT)
## check if the new file's info is in silo
assert self.silo.exists(self.TEST_FILE_MUTANT)
+ assert_equal(None, self.silo.node_get('file_created',
+ self.TEST_FILE_MUTANT))
self.purge_list.append(self.TEST_FILE_MUTANT)
@@ -283,12 +285,15 @@ class TestEvents(object):
time.sleep(1)
## check if FOO_DIR is created under the combox directory
assert path.isdir(self.FOO_DIR)
-
+ assert_equal(None, self.silo.node_get('file_created',
+ self.FOO_DIR))
self.BAR_DIR = path.join(self.FOO_DIR, 'bar')
mk_nodedir(self.BAR_DIR, self.config)
time.sleep(1)
## check if BAR_DIR is created under the combox directory.
assert path.isdir(self.BAR_DIR)
+ assert_equal(None, self.silo.node_get('file_created',
+ self.BAR_DIR))
self.purge_list.append(self.FOO_DIR)