summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-08-25 23:23:31 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-08-25 23:23:31 -0400
commitd5b52030348d40600b4c9256f76e5183a85fbb17 (patch)
treed0a1eeebd22ef7ef09da578b598d598b53873ae2
parentcd2900ad565fd4e77c68607aabc819184f4ffc06 (diff)
bug fix (b#4).
modified: TODO.org modified: combox/events.py
-rw-r--r--TODO.org10
-rw-r--r--combox/events.py9
2 files changed, 17 insertions, 2 deletions
diff --git a/TODO.org b/TODO.org
index b540db2..741eadf 100644
--- a/TODO.org
+++ b/TODO.org
@@ -1,7 +1,7 @@
* combox
** bugs :bugs:
*** platform specific :platform-specific:
-**** DONE use os.path.expanduser to get user's home directory :#1:
+**** DONE use os.path.expanduser to get user's home directory :b#1:
CLOSED: [2015-04-09 Thu 17:21]
- CLOSING NOTE [2015-04-09 Thu 17:21] \\
Done. But I'm not sure if fix the issue in Windows though.
@@ -11,6 +11,14 @@
Thanks to Dr. Green for finding this.
[1]: http://stackoverflow.com/questions/4028904/how-to-get-the-home-directory-in-python
+**** TODO combox not handling temprorary files created by editors properly :b#2:
+**** TODO config has problems creating nested node directories :b#3:
+**** DONE NodeDirMonitor.on_modified assums shard 0 is always available :b#4:
+ CLOSED: [2015-08-25 Tue 23:21]
+ - CLOSING NOTE [2015-08-25 Tue 23:21] \\
+ Fixed this. Now it checks if all shards are available before
+ doing decrypt and glue.
+ This is not always the case.
** functionlity
*** DONE rewrite combox.events.NodeDirMonitor.on_created method
CLOSED: [2015-04-01 Wed 23:06]
diff --git a/combox/events.py b/combox/events.py
index 4695c00..c0bc224 100644
--- a/combox/events.py
+++ b/combox/events.py
@@ -29,7 +29,7 @@ from combox.crypto import split_and_encrypt, decrypt_and_glue
from combox.file import (mk_nodedir, rm_nodedir, rm_shards,
relative_path, move_shards, move_nodedir,
cb_path, node_path, hash_file, rm_path,
- node_paths)
+ node_paths, no_of_shards)
from combox.silo import ComboxSilo
@@ -397,6 +397,13 @@ class NodeDirMonitor(LoggingEventHandler):
file_cb_path = cb_path(event.src_path, self.config)
+ # get no. shards available
+ shards_there = no_of_shards(file_cb_path, self.config)
+
+ if shards_there != self.num_nodes:
+ # got to wait for other shards to arrive!
+ return
+
if event.is_directory:
# do nothing
pass