mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-21 11:25:14 +00:00
Use DIR-IMM and t=mkdir-immutable for "tahoe backup", for #828
This commit is contained in:
parent
834b20210a
commit
6e7fb1006d
@ -336,16 +336,17 @@ tahoe mv tahoe:uploaded.txt fun:uploaded.txt
|
||||
tahoe backup ~ work:backups
|
||||
|
||||
This command performs a full versioned backup of every file and directory
|
||||
underneath your "~" home directory, placing a read-only timestamped snapshot
|
||||
in e.g. work:backups/Archives/2009-02-06_04:00:05Z/ (note that the timestamp
|
||||
is in UTC, hence the "Z" suffix), and a link to the latest snapshot in
|
||||
work:backups/Latest/ . This command will use a small SQLite database known
|
||||
as the "backupdb", stored in ~/.tahoe/private/backupdb.sqlite, to remember
|
||||
which local files have been backed up already, and will avoid uploading
|
||||
files that have already been backed up. It compares timestamps and filesizes
|
||||
when making this comparison. The "tahoe backup" command also shares
|
||||
directories with the previous backup when nothing has changed, to run faster
|
||||
and to reduce the number of directories created.
|
||||
underneath your "~" home directory, placing an immutable timestamped
|
||||
snapshot in e.g. work:backups/Archives/2009-02-06_04:00:05Z/ (note that the
|
||||
timestamp is in UTC, hence the "Z" suffix), and a link to the latest
|
||||
snapshot in work:backups/Latest/ . This command will use a small SQLite
|
||||
database known as the "backupdb", stored in
|
||||
~/.tahoe/private/backupdb.sqlite, to remember which local files have been
|
||||
backed up already, and will avoid uploading files that have already been
|
||||
backed up. It compares timestamps and filesizes when making this comparison.
|
||||
The "tahoe backup" command also shares directories with the previous backup
|
||||
when nothing has changed, to run faster and to reduce the number of
|
||||
directories created.
|
||||
|
||||
tahoe backup --exclude=*~ ~ work:backups
|
||||
|
||||
|
@ -83,21 +83,18 @@ def get_local_metadata(path):
|
||||
return metadata
|
||||
|
||||
def mkdir(contents, options):
|
||||
url = options['node-url'] + "uri?t=mkdir"
|
||||
resp = do_http("POST", url)
|
||||
if resp.status < 200 or resp.status >= 300:
|
||||
raiseHTTPError("error during mkdir", resp)
|
||||
dircap = str(resp.read().strip())
|
||||
url = options['node-url'] + "uri/%s?t=set_children" % urllib.quote(dircap)
|
||||
body = dict([ (childname, (contents[childname][0],
|
||||
kids = dict([ (childname, (contents[childname][0],
|
||||
{"ro_uri": contents[childname][1],
|
||||
"metadata": contents[childname][2],
|
||||
}))
|
||||
for childname in contents
|
||||
])
|
||||
resp = do_http("POST", url, simplejson.dumps(body))
|
||||
if resp.status != 200:
|
||||
raiseHTTPError("error during set_children", resp)
|
||||
body = simplejson.dumps(kids)
|
||||
url = options['node-url'] + "uri?t=mkdir-immutable"
|
||||
resp = do_http("POST", url, body)
|
||||
if resp.status < 200 or resp.status >= 300:
|
||||
raiseHTTPError("error during mkdir", resp)
|
||||
dircap = str(resp.read().strip())
|
||||
return dircap
|
||||
|
||||
def put_child(dirurl, childname, childcap):
|
||||
|
@ -998,11 +998,16 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
|
||||
self.failUnlessEqual(dr, 0)
|
||||
d.addCallback(_check0)
|
||||
|
||||
d.addCallback(lambda res: self.do_cli("ls", "tahoe:backups"))
|
||||
d.addCallback(lambda res: self.do_cli("ls", "--uri", "tahoe:backups"))
|
||||
def _check1((rc, out, err)):
|
||||
self.failUnlessEqual(err, "")
|
||||
self.failUnlessEqual(rc, 0)
|
||||
self.failUnlessEqual(sorted(out.split()), ["Archives", "Latest"])
|
||||
lines = out.split("\n")
|
||||
children = dict([line.split() for line in lines if line])
|
||||
latest_uri = children["Latest"]
|
||||
self.failUnless(latest_uri.startswith("URI:DIR2-CHK:"), latest_uri)
|
||||
childnames = children.keys()
|
||||
self.failUnlessEqual(sorted(childnames), ["Archives", "Latest"])
|
||||
d.addCallback(_check1)
|
||||
d.addCallback(lambda res: self.do_cli("ls", "tahoe:backups/Latest"))
|
||||
def _check2((rc, out, err)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user