immutable file, the "offset" parameter is not valid.
When creating a new file, you can control the type of file created by
- specifying a format= argument in the query string. format=mdmf creates an MDMF
- mutable file. format=sdmf creates an SDMF mutable file. format=chk creates an
+ specifying a format= argument in the query string. format=MDMF creates an MDMF
+ mutable file. format=SDMF creates an SDMF mutable file. format=CHK creates an
immutable file. The value of the format argument is case-insensitive. For
compatibility with previous versions of Tahoe-LAFS, the webapi will also
accept a mutable=true argument in the query string. If mutable=true is given,
new code should use POST.
This supports a format= argument in the query string. The format=
- argument, if specified, controls the format of the directory. format=mdmf
- indicates that the directory should be stored as an MDMF file; format=sdmf
+ argument, if specified, controls the format of the directory. format=MDMF
+ indicates that the directory should be stored as an MDMF file; format=SDMF
indicates that the directory should be stored as an SDMF file. The value of
the format= argument is case-insensitive. If no format= argument is
given, the directory's format is determined by the default mutable file
"verify_uri": verify_uri,
"size": bytes,
"mutable": false,
- "format": "chk"
+ "format": "CHK"
} ]
If it is a capability to a directory followed by a path from that directory
"verify_uri": verify_uri,
"size": bytes,
"mutable": false,
- "format": "chk",
+ "format": "CHK",
"metadata": {
"ctime": 1202777696.7564139,
"mtime": 1202777696.7564139,
"ro_uri": read_only_uri,
"verify_uri": verify_uri,
"mutable": true,
- "format": "sdmf",
+ "format": "SDMF",
"children": {
"foo.txt": [ "filenode",
{
def _check_mdmf_json(self, (rc, json, err)):
self.failUnlessEqual(rc, 0)
self.failUnlessEqual(err, "")
- self.failUnlessIn('"format": "mdmf"', json)
+ self.failUnlessIn('"format": "MDMF"', json)
# We also want a valid MDMF cap to be in the json.
self.failUnlessIn("URI:MDMF", json)
self.failUnlessIn("URI:MDMF-RO", json)
def _check_sdmf_json(self, (rc, json, err)):
self.failUnlessEqual(rc, 0)
self.failUnlessEqual(err, "")
- self.failUnlessIn('"format": "sdmf"', json)
+ self.failUnlessIn('"format": "SDMF"', json)
# We also want to see the appropriate SDMF caps.
self.failUnlessIn("URI:SSK", json)
self.failUnlessIn("URI:SSK-RO", json)
self.failUnlessIn(self._sdmf_uri, out)
self.failUnlessIn(self._sdmf_readonly_uri, out)
self.failUnlessIn(self._imm_uri, out)
- self.failUnlessIn('"format": "sdmf"', out)
- self.failUnlessIn('"format": "mdmf"', out)
+ self.failUnlessIn('"format": "SDMF"', out)
+ self.failUnlessIn('"format": "MDMF"', out)
d.addCallback(_got_json)
return d
d2.addCallback(lambda ign: self.do_cli("ls", "--json", dirname))
d2.addCallback(_check, uri_prefix)
d2.addCallback(lambda ign: self.do_cli("ls", "--json", self._filecap))
- d2.addCallback(_check, '"format": "%s"' % (mutable_type.lower(),))
+ d2.addCallback(_check, '"format": "%s"' % (mutable_type.upper(),))
return d2
d.addCallback(_mkdir, "sdmf", "URI:DIR2", "tahoe:foo")
d.addCallback(_stash_dircap)
d.addCallback(lambda res: self.do_cli("ls", "--json",
self._filecap))
- d.addCallback(_check, '"format": "sdmf"')
+ d.addCallback(_check, '"format": "SDMF"')
d.addCallback(lambda res: self.do_cli("mkdir", "--mutable-type=mdmf"))
d.addCallback(_check, "URI:DIR2-MDMF")
d.addCallback(_stash_dircap)
d.addCallback(lambda res: self.do_cli("ls", "--json",
self._filecap))
- d.addCallback(_check, '"format": "mdmf"')
+ d.addCallback(_check, '"format": "MDMF"')
return d
def test_mkdir_bad_mutable_type(self):
return filecap
d.addCallback(_got_filecap)
d.addCallback(lambda filecap: self.GET("/uri/%s?t=json" % filecap))
- d.addCallback(lambda json: self.failUnlessIn("mdmf", json))
+ d.addCallback(lambda json: self.failUnlessIn("MDMF", json))
return d
def test_PUT_NEWFILEURL_unlinked_sdmf(self):
d = self.PUT("/uri?format=sdmf",
contents)
d.addCallback(lambda filecap: self.GET("/uri/%s?t=json" % filecap))
- d.addCallback(lambda json: self.failUnlessIn("sdmf", json))
+ d.addCallback(lambda json: self.failUnlessIn("SDMF", json))
return d
def test_PUT_NEWFILEURL_unlinked_bad_format(self):
self.failUnlessIn("format", data)
self.failUnlessEqual(data["format"], version)
- d.addCallback(_got_json, "mdmf")
+ d.addCallback(_got_json, "MDMF")
# Now make an SDMF file and check that it is reported correctly.
d.addCallback(lambda ignored:
self.PUT("/uri?format=sdmf",
self.NEWFILE_CONTENTS * 300000))
d.addCallback(lambda filecap: self.GET("/uri/%s?t=json" % filecap))
- d.addCallback(_got_json, "sdmf")
+ d.addCallback(_got_json, "SDMF")
return d
def test_GET_FILEURL_json_mdmf(self):
mdmf_data = kids['mdmf.txt'][1]
self.failUnlessIn("format", mdmf_data)
- self.failUnlessEqual(mdmf_data["format"], "mdmf")
+ self.failUnlessEqual(mdmf_data["format"], "MDMF")
sdmf_data = kids['sdmf.txt'][1]
self.failUnlessIn("format", sdmf_data)
- self.failUnlessEqual(sdmf_data["format"], "sdmf")
+ self.failUnlessEqual(sdmf_data["format"], "SDMF")
d.addCallback(_got_json)
return d
data = simplejson.loads(json)
data = data[1]
self.failUnlessIn("format", data)
- self.failUnlessEqual(data["format"], format.lower())
+ self.failUnlessEqual(data["format"], format.upper())
d.addCallback(_got_json)
return d
d = defer.succeed(None)
data = simplejson.loads(json)
data = data[1]
self.failUnlessIn("format", data)
- self.failUnlessEqual(data["format"], format.lower())
+ self.failUnlessEqual(data["format"], format.upper())
d.addCallback(_got_json)
return d
data = simplejson.loads(json)
data = data[1]
self.failUnlessIn("format", data)
- self.failUnlessEqual(data["format"], "mdmf")
+ self.failUnlessEqual(data["format"], "MDMF")
self.failUnless(data['rw_uri'].startswith("URI:MDMF"))
self.failUnless(data['ro_uri'].startswith("URI:MDMF"))
d.addCallback(_got_json)
data = simplejson.loads(json)
data = data[1]
self.failUnlessIn("format", data)
- self.failUnlessEqual(data["format"], "sdmf")
+ self.failUnlessEqual(data["format"], "SDMF")
d.addCallback(_got_json)
return d
mutable_type = childnode.get_version()
assert mutable_type in (SDMF_VERSION, MDMF_VERSION)
if mutable_type == MDMF_VERSION:
- file_format = "mdmf"
+ file_format = "MDMF"
else:
- file_format = "sdmf"
+ file_format = "SDMF"
else:
- file_format = "chk"
+ file_format = "CHK"
kiddata[1]['format'] = file_format
elif IDirectoryNode.providedBy(childnode):
mutable_type = filenode.get_version()
assert mutable_type in (SDMF_VERSION, MDMF_VERSION)
if mutable_type == MDMF_VERSION:
- file_format = "mdmf"
+ file_format = "MDMF"
else:
- file_format = "sdmf"
+ file_format = "SDMF"
else:
- file_format = "chk"
+ file_format = "CHK"
data[1]['format'] = file_format
return text_plain(simplejson.dumps(data, indent=1) + "\n", ctx)