diff options
author | Dan Williams <dcbw@redhat.com> | 2007-09-08 01:42:17 (GMT) |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-09-08 01:42:17 (GMT) |
commit | 0e38f871622d85b0c4651d0fc64c4693b805eb79 (patch) | |
tree | e0d45fb335a7f95fac518da8719f1a59c88d4182 /src/olpc/datastore/bin_copy.py | |
parent | f46c8674cd85aef7dc38d7b70a3de7225a884d51 (diff) |
Copy items asynchronously, support moves instead of copies
update() and create() now support a 'transfer_ownership' argument that
causes the datastore to move the object, rather than copy it when it can.
When copies must be done, the copy is internally asynchronous when
possible to allow the datastore to continue processing requests from
clients while the copy is ongoing.
Diffstat (limited to 'src/olpc/datastore/bin_copy.py')
-rw-r--r-- | src/olpc/datastore/bin_copy.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/olpc/datastore/bin_copy.py b/src/olpc/datastore/bin_copy.py index 1be1b6b..df28052 100644 --- a/src/olpc/datastore/bin_copy.py +++ b/src/olpc/datastore/bin_copy.py @@ -9,6 +9,13 @@ def bin_copy(src, dest, mode=0600): else: os.chmod(dest, mode) +def bin_mv(src, dest, mode=0600): + try: + subprocess.check_call(['/bin/mv', src, dest]) + except subprocess.CalledProcessError: + raise OSError("Move failed %s %s" % (src, dest)) + else: + os.chmod(dest, mode) if __name__ == "__main__": import sys |