summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-09-07 19:27:48 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-09-07 19:27:48 -0400
commitc3b737ccb642aeec4f19e08c9c8185c63d1c7162 (patch)
tree619226abaa6fe7e6fb2e9a20cd6056f839d91f20
parentf62ab061a9c4e33873ade9c96c4393850138a361 (diff)
combox.events: plaftorm specific changes.
In NodeDirMonitor's on_moved method, when we detect that a shard is modified, we push the info, about the shard modification, to silo from the on_moved for the OS X platform.
-rw-r--r--combox/events.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/combox/events.py b/combox/events.py
index baa4b44..d2a2b70 100644
--- a/combox/events.py
+++ b/combox/events.py
@@ -17,6 +17,7 @@
# <http://www.gnu.org/licenses/>.
import os
+import platform
import logging
from os import path
@@ -386,13 +387,25 @@ class NodeDirMonitor(LoggingEventHandler):
print "Okay, %s (%s) was actually modified." % (cb_filename,
event.dest_path)
self.silo.node_rem('file_deleted', cb_filename)
- self.silo.node_set('file_modified', cb_filename)
- num = self.silo.node_get('file_modified', cb_filename)
- if num == self.num_nodes:
- decrypt_and_glue(cb_filename, self.config)
- # update db.
- self.silo.update(cb_filename)
- self.silo.node_rem('file_modified', cb_filename)
+ # Next, if we're on GNU/Linux, watchdog detects that
+ # the shard was modified and generates calls the
+ # on_modified method. So we don't have to store
+ # information in the silo about this shard being
+ # modified; we do that later in the on_modified
+ # method.
+ #
+ # But, on OS X (a.k.a Darwin), watchdog detect the
+ # shard is modified and does not generate a call to
+ # the on_modified method. So we store the information
+ # about the modified shard here itself.
+ if platform.system() == 'Darwin':
+ self.silo.node_set('file_modified', cb_filename)
+ num = self.silo.node_get('file_modified', cb_filename)
+ if num == self.num_nodes:
+ decrypt_and_glue(cb_filename, self.config)
+ # update db.
+ self.silo.update(cb_filename)
+ self.silo.node_rem('file_modified', cb_filename)
return