From e6ec8eb8e33542c8975f3ba1e96de7e2d43d221b Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Sat, 12 Sep 2015 13:03:12 -0400 Subject: Introduced `node_store_moved_info' method in combox.silo.ComboxSilo class. This method allows us to track old path and new path of the file which is being renamed/moved. modified: combox/silo.py modified: tests/silo_test.py --- combox/silo.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'combox') diff --git a/combox/silo.py b/combox/silo.py index 1b3eeac..b9ffc13 100644 --- a/combox/silo.py +++ b/combox/silo.py @@ -41,7 +41,7 @@ class ComboxSilo(object): ## things we need for housekeep the node directory. self.node_dicts = ['file_created', 'file_modified', 'file_moved', - 'file_deleted'] + 'file_deleted', 'file_moved_info'] # created the dicts if not already created. for ndict in self.node_dicts: @@ -169,6 +169,19 @@ class ComboxSilo(object): self.db.dadd(type_, (file_, num)) + def node_store_moved_info(self, src_path, dest_path): + """ + Update/create about file move. + + type_: expected type is 'file_moved_info'. + src_path: usually the source path of the file being moved. + dest_path: usually the destination path of the file being moved. + """ + self.reload() + with self.lock: + self.db.dadd('file_moved_info', (src_path, dest_path)) + + def node_get(self, type_, file_): """ Returns a number denoting the number of node directories in which the file_'s shard was created/modified/moved/deleted. -- cgit v1.2.3