combox

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

commit f9d7db4d7ac069a892201d60826775a73ae38939
parent bc0ea5e199b2ead207e07814523e0a287a4600c7
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Wed,  4 Mar 2015 20:07:43 -0500

combox/events.py: fixed the silo bug.

In both the ComboxDirMonitor and the NodeDirMonitor all the methods --
housekeep, on_created, on_moved, on_deleted, on_modified -- called the
silo_update method before doing anything.

The silo_update() method re-reads the silo from disk.

Diffstat:
combox/events.py | 19++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/combox/events.py b/combox/events.py @@ -51,6 +51,13 @@ class ComboxDirMonitor(LoggingEventHandler): self.housekeep() + def silo_update(self): + """ + Re-reads the silo from disk. + """ + self.silo = ComboxSilo(self.config) + + def housekeep(self): """Recursively traverses combox directory, discovers changes and updates silo and node directories. @@ -66,6 +73,7 @@ class ComboxDirMonitor(LoggingEventHandler): updated and the file's shards are updated. """ + self.silo_update() print "combox is housekeeping." print "Please don't make any changes to combox directory now." print "Thanks for your patience." @@ -105,6 +113,7 @@ class ComboxDirMonitor(LoggingEventHandler): def on_moved(self, event): super(ComboxDirMonitor, self).on_moved(event) + self.silo_update() if event.is_directory: # creates a corresponding directory at the node dirs. @@ -119,6 +128,7 @@ class ComboxDirMonitor(LoggingEventHandler): def on_created(self, event): super(ComboxDirMonitor, self).on_created(event) + self.silo_update() file_node_path = node_path(event.src_path, self.config) @@ -135,6 +145,7 @@ class ComboxDirMonitor(LoggingEventHandler): def on_deleted(self, event): super(ComboxDirMonitor, self).on_deleted(event) + self.silo_update() if event.is_directory: # Delete corresponding directory in the nodes. @@ -149,6 +160,7 @@ class ComboxDirMonitor(LoggingEventHandler): def on_modified(self, event): super(ComboxDirMonitor, self).on_modified(event) + self.silo_update() if event.is_directory: # do nothing @@ -201,16 +213,17 @@ class NodeDirMonitor(LoggingEventHandler): location in the combox directory. """ - pass + self.silo_update() def on_moved(self, event): super(NodeDirMonitor, self).on_moved(event) - pass + self.silo_update() def on_created(self, event): super(NodeDirMonitor, self).on_created(event) + self.silo_update() file_cb_path = cb_path(event.src_path, self.config) @@ -232,7 +245,7 @@ class NodeDirMonitor(LoggingEventHandler): def on_deleted(self, event): super(ComboxDirMonitor, self).on_deleted(event) - pass + self.silo_update() def on_modified(self, event):