mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-23 01:08:53 +00:00
dirnode: add 'tahoe'/'linkcrtime' and 'tahoe'/'linkmotime' to take the place of what 'mtime'/'ctime' originally did, and make the 'tahoe' subdict be unwritable through the set_children API
Also add extensive documentation in docs/frontends/webapi.txt about the behaviors of these values. See ticket #628.
This commit is contained in:
@ -83,15 +83,41 @@ class Adder:
|
||||
metadata = children[name][1].copy()
|
||||
else:
|
||||
metadata = {"ctime": now,
|
||||
"mtime": now}
|
||||
if new_metadata is None:
|
||||
# update timestamps
|
||||
"mtime": now,
|
||||
"tahoe": {
|
||||
"linkcrtime": now,
|
||||
"linkmotime": now,
|
||||
}
|
||||
}
|
||||
|
||||
if new_metadata is not None:
|
||||
# Overwrite all metadata.
|
||||
newmd = new_metadata.copy()
|
||||
|
||||
# Except 'tahoe'.
|
||||
if newmd.has_key('tahoe'):
|
||||
del newmd['tahoe']
|
||||
if metadata.has_key('tahoe'):
|
||||
newmd['tahoe'] = metadata['tahoe']
|
||||
|
||||
metadata = newmd
|
||||
else:
|
||||
# For backwards compatibility with Tahoe < 1.4.0:
|
||||
if "ctime" not in metadata:
|
||||
metadata["ctime"] = now
|
||||
metadata["mtime"] = now
|
||||
else:
|
||||
# just replace it
|
||||
metadata = new_metadata.copy()
|
||||
|
||||
# update timestamps
|
||||
sysmd = metadata.get('tahoe', {})
|
||||
if not 'linkcrtime' in sysmd:
|
||||
if "ctime" in metadata:
|
||||
# In Tahoe < 1.4.0 we used the word "ctime" to mean what Tahoe >= 1.4.0
|
||||
# calls "linkcrtime".
|
||||
sysmd["linkcrtime"] = metadata["ctime"]
|
||||
else:
|
||||
sysmd["linkcrtime"] = now
|
||||
sysmd["linkmotime"] = now
|
||||
|
||||
children[name] = (child, metadata)
|
||||
new_contents = self.node._pack_contents(children)
|
||||
return new_contents
|
||||
|
Reference in New Issue
Block a user