summaryrefslogtreecommitdiffstats
path: root/combox
Commit message (Collapse)AuthorAgeFilesLines
* combox.silo.ComboxSilo.node_set: added an optional parameter called `num'.Siddharth Ravikumar2015-04-291-1/+5
| | | | | | | - Updated tests as usual. modified: combox/silo.py modified: tests/silo_test.py
* rewrote combox.events.NodeDirMonitor.on_moved method.Siddharth Ravikumar2015-04-221-4/+11
| | | | | | | | | | | | | - Now the node monitor waits for all shards of the file, which was moved/renamed on a remote computer, to get moved/renamed on this computer, before it finally reconstructs the moved/renamed file in the combox directory on this computer. - Updated the tests for on_moved method at tests.events_test.TestEvents.test_NDM_onmoved method. modified: combox/events.py modified: tests/events_test.py
* rewrote combox.events.NodeDirMonitor.on_deleted method.Siddharth Ravikumar2015-04-151-6/+20
| | | | | | | | | | | | | | | | | | | | | - Now the the node monitor waits for all shards of the file, which was deleted on a remote computer, to get deleted on this computer, before it finally deletes the respective file in the combox directory. - Tests for it is at tests.events_test.TestEvents.test_NDM_ondeleted method. modified: combox/events.py modified: tests/events_test.py Did some of this while listening to Cat Stevens' (Yusuf): - Just Another Night - Wild World - Father and son (*) - Peace train - Moonshadow (*)
* combox/silo.py: added comment in ComboxSilo.node_set()Siddharth Ravikumar2015-04-151-1/+4
|
* fixed bug #1 (platform-specific)Siddharth Ravikumar2015-04-092-5/+8
| | | | | | | we're using os.path.expanduser instead of os.getenv('HOME'). modified: combox/cbox.py modified: combox/config.py
* rewrote combox.events.NodeDirMonitor.on_modified method.Siddharth Ravikumar2015-04-081-3/+8
| | | | | | | | | | | | | | | | - Now the the node monitor waits for all shards of the file, which was modified on a remote computer, to arrive on this computer, before it re-constructs the file into the respective location in the combox directory. - Tests for it is at tests.events_test.TestEvents.test_NDM_onmodified method. modified: combox/events.py modified: tests/events_test.py Part of this was done while listening to Avril's "Complicated" ; I think this is the only modern Pop song which I like.
* After a file which was created a in a remote computer is reconstructed in ↵Siddharth Ravikumar2015-04-081-0/+2
| | | | | | | this computer, its info is removed from the 'file_created' dictionary in the silo. modified: combox/events.py modified: tests/events_test.py
* new method combox.silo.ComboxSilo.node_remSiddharth Ravikumar2015-04-081-0/+18
| | | | | | | | | | | The method removes information about a file in the category `type_' where `type_' can be 'file_created', 'file_modified', 'file_removed', 'file_moved'. Also wrote tests for it :~( modified: combox/silo.py modified: tests/silo_test.py
* [golden commit]: rewrote combox.events.NodeDirMonitor.on_created method.Siddharth Ravikumar2015-04-011-5/+17
| | | | | | | | | | | | | | | | | | | | | - Now the the node monitor waits for all shards of the file, which was created on a remote computer, to arrive on this computer, before it re-constructs the file into the respective location in the combox directory. - Tests for it is at tests.events_test.TestEvents.test_NDM_oncreate method. - The main test method, tests.events_test.TestEvents.test_NDM, was disabled by renaming it to tests.events_test.TestEvents.test_NDM. - Now the NodeDirMonitor requires passing the 'node monitor lock' when creating an instance of it. :~( modified: combox/events.py modified: tests/events_test.py
* updated combox.file.relative_path.Siddharth Ravikumar2015-04-011-1/+8
| | | | | | | | | This method now returns relative paths w. r. t all node directories. Before it used to return relative paths only w. r. t the first node directory. Also updated the tests for it :~( modified: combox/file.py modified: tests/file_test.py
* new variable at NodeDirMonitor -- `num_nodes'Siddharth Ravikumar2015-04-011-0/+2
| | | | | | | `num_nodes' a value that represents the number of node directories. modified: combox/events.py modified: tests/events_test.py
* renamed dict names in combox.silo.ComboxSilo from shard_* -> file_*Siddharth Ravikumar2015-04-011-4/+4
| | | | | | | | The main zarking reason for the name is that we might also want to track directories apart from shards in the node directories. modified: combox/silo.py modified: tests/silo_test.py
* Now combox.silo.ComboxSilo reloads db from disk before reading/writing.Siddharth Ravikumar2015-04-012-30/+13
| | | | | modified: combox/events.py modified: combox/silo.py
* refactored the way locks work in combox.siloComboxSilo.Siddharth Ravikumar2015-04-013-11/+20
| | | | | | | | modified: combox/cbox.py modified: combox/events.py modified: combox/silo.py modified: tests/events_test.py modified: tests/silo_test.py
* new methods in combox.silo.ComboxSilo -- node_get, node_set. noddicts.Siddharth Ravikumar2015-03-311-0/+39
| | | | | | | | These methods will be used to manage the dictionaries in the db related to the zarking shards. modified: combox/silo.py modified: tests/silo_test.py
* ComboxSilo is now going to have dictionaries that track information about ↵Siddharth Ravikumar2015-03-312-2/+18
| | | | | | | the shards. modified: combox/events.py modified: combox/silo.py
* combox.events.NodDirMonitor: corrected typo in docstring.Siddharth Ravikumar2015-03-261-1/+1
|
* fleshed out combox.events.NodDirMonitor.housekeep method.Siddharth Ravikumar2015-03-261-1/+49
| | | | | | | wrote tests for it too :~( modified: combox/events.py modified: tests/events_test.py
* new function combox.file.node_paths: returns the abs. path of ↵Siddharth Ravikumar2015-03-191-0/+28
| | | | | | | shards/directories in node directories. modified: combox/file.py modified: tests/file_test.py
* combox/file.py: edited docstring of the node_path method.Siddharth Ravikumar2015-03-191-2/+3
|
* combox/silo.py: All access to DB are now inside a critcal section.Siddharth Ravikumar2015-03-191-11/+17
| | | | | | | This just means, only one damn Thread is allowed to access the DB at a time. We are using thread.Lock to achieve this.
* fleshed out the on_move method in combox.events.NodeDirMonitorSiddharth Ravikumar2015-03-181-0/+15
| | | | | | | As usual, wrote correponding tests for it; zarking TDD or whatever :~| modified: combox/events.py modified: tests/events_test.py
* combox/silo.py: modded remove method in ComboxSiloSiddharth Ravikumar2015-03-181-1/+5
| | | | | The statement that removes the key from db is now put in a try-catch f#*king block.
* updated on_created, on_modified, on_deleted methods in NodeDirMonitor.Siddharth Ravikumar2015-03-131-0/+15
| | | | | | | Now they check if the event.src_path is a shard or a directory before doing anything. modified: combox/events.py
* Added `shardp' method to combox.events.NodeDirMonitor + test for it.Siddharth Ravikumar2015-03-131-0/+11
| | | | | modified: combox/events.py modified: tests/events_test.py
* updated on_delete method in combox.events.NodeDirMonitorSiddharth Ravikumar2015-03-061-1/+1
| | | | | | | Now the method deletes the corresponding file in the combox directory only if has not already been deleted. modified: combox/events.py
* updated the on_delete method in the combox.events.ComboxDirMonitor class.Siddharth Ravikumar2015-03-061-2/+5
| | | | | | | It now deletes the directory or file shard in the node directories only if they were not already deleted. modified: combox/events.py
* modded combox.file.node_path function.Siddharth Ravikumar2015-03-062-3/+5
| | | | | | | | | | | It has a third argument (boolean) which tells whether `cb_path' (the first argument) is a file or not. Updated the test for node_path function + code wherever node_path was used. modified: combox/events.py modified: combox/file.py modified: tests/file_test.py
* fleshed out the on_delete method in combox.events.NodeDirMonitorSiddharth Ravikumar2015-03-041-2/+13
| | | | | | | As usual, wrote correponding tests for it :| modified: combox/events.py modified: tests/events_test.py
* fixed combox.file.cb_pathSiddharth Ravikumar2015-03-041-1/+1
| | | | | | instead of using `path.isfile' to check if the path is a shard file or not, it is checked if the path endswidth 'shard.N' where `N' is a number.
* renamed combox.file.rm_dir -> combox.file.rm_pathSiddharth Ravikumar2015-03-041-4/+10
| | | | | | | | rm_path deletes a file or an empty directory. updated the test for it too. modified: tests/file_test.py
* combox.file.mk_nodedir uses mk_dir to create a directory.Siddharth Ravikumar2015-03-041-4/+1
|
* combox.file.rm_nodedir uses the rm_dir function to remove directories.Siddharth Ravikumar2015-03-041-4/+1
|
* new function combox.file.mk_dirSiddharth Ravikumar2015-03-041-0/+8
| | | | | | | wrote test for it too. modified: combox/file.py modified: tests/file_test.py
* new function combox.file.rm_dirSiddharth Ravikumar2015-03-041-0/+8
| | | | | | | also wrote test for it. modified: combox/file.py modified: tests/file_test.py
* combox/events.py: fixed the silo bug.Siddharth Ravikumar2015-03-041-3/+16
| | | | | | | | 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.
* fleshed out the NodeDirMonitor's on_modified method + wrote tests for it.Siddharth Ravikumar2015-02-261-2/+30
| | | | | modified: combox/events.py modified: tests/events_test.py
* modded combox.file.hash_file function -- added new arg `file_content'Siddharth Ravikumar2015-02-261-2/+5
| | | | | | | | | | - `file_content' is set to None by default - If `file_content' is not None, hash of this is returned. Updated the test for hash_file function. modified: combox/file.py modified: tests/file_test.py
* updated combox.silo.ComboxSilo.stale method - added new arg fhashSiddharth Ravikumar2015-02-261-3/+5
| | | | | | | | - the arg `fhash' is set to None by default. - if `fhash' is not None, it is considered as file's current hash. modified: combox/silo.py modified: tests/silo_test.py
* modded combox.crypto.decrypt_and_glue - added new arg called `write'Siddharth Ravikumar2015-02-261-4/+7
| | | | | - 'write' is set to True by set default. - If `write' is set, then the reconstructed file content is written to disk.
* updated combox.events.ComboxDirMonitor.on_create methodSiddharth Ravikumar2015-02-251-3/+6
| | | | | | | | Now the file shards or directory is created in the node directories only if they don't already exist; if they exist that means this file was created from another computer (also running combox). modified: combox/events.py
* new function combox.file.node_path.Siddharth Ravikumar2015-02-251-0/+22
| | | | | | | | | | | | | This function takes the path to the file in the combox and returns the path of its first shard in the node directory. If the the given argument is a directory (inside the combox directory), the function returns the corresponding path of the directory under the first node directory. Test for the function was also written. modified: combox/file.py modified: tests/file_test.py
* New combox.events.NodeDirMonitor class defined.Siddharth Ravikumar2015-02-201-2/+76
| | | | | | | | | | At the moment only the on_created method of this class is kinda fleshed out. The tests for this class is at tests.events_test.TestEvents.test_NDM modified: combox/events.py modified: tests/events_test.py
* Refactored combox.crypto.split_and_encrypt function.Siddharth Ravikumar2015-02-201-5/+12
| | | | Now it accepts an optional third argument `fcontent' (defaults to None) which contains the contents of the file `fpath'.
* Refactored combox.file.cb_path to accept a file or a directory under a node ↵Siddharth Ravikumar2015-02-201-5/+15
| | | | | | | | | | | directory. It returns the path of the respective file or directory in the combox directory. Also updated the test for this function at tests.file_test.TestFile.test_cbpath modified: combox/file.py modified: tests/file_test.py
* combox/crypto.py: corrected typo in docstring of decrypt_and_glue function.Siddharth Ravikumar2015-02-191-1/+1
|
* Defined new function in combox.file.cb_pathSiddharth Ravikumar2015-02-191-0/+10
| | | | | | | | | | This function, given the path of a file shard, returns the corresponding path of the file in the combox directory. The test for this function is at tests.file_test.TestFile.test_cbpath modified: combox/file.py modified: tests/file_test.py
* modded combox.file.relative_path function.Siddharth Ravikumar2015-02-191-4/+13
| | | | | | | | | | Now the function is rigged up to return path relative to both combox directory and node directory. Corresponding test for this function is at tests.file_test module. modified: combox/file.py modified: tests/file_test.py
* combox/config.py: added a new arg `write' (boolean) to cb_config function.Siddharth Ravikumar2015-02-091-5/+8
| | | | | | `write' is set to 'True' by default. If `write' is 'True' the generated config is written to the disk; otherwise it is returned.
* [bugfix]: combox/config.py - when empty string is given for 'silo_dir'; it ↵Siddharth Ravikumar2015-02-081-2/+4
| | | | | | | | | | | | | | | | sets the dir to PWD, this was not intended. This was fixed. When empty string is given for 'silo_dir', the intended default directory was the combox's config directory. The input to 'silo_dir' was directly given to path.abspath() The path.abspath() function, when an empty string is given returns the PWD. That's where the bug was! So, now the 'silo_dir' input is read to a local variable `silo_dir'. If the local variable `silo_dir' is empty, the combox config directory is assigned; else, the given directory is assigned.