From d5b52030348d40600b4c9256f76e5183a85fbb17 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Tue, 25 Aug 2015 23:23:31 -0400 Subject: bug fix (b#4). modified: TODO.org modified: combox/events.py --- TODO.org | 10 +++++++++- combox/events.py | 9 ++++++++- 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 -- cgit v1.2.3