From 10f72e461d2b90083e9aed5d0a2d32de44aeffe3 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 11 Aug 2015 18:24:33 +0100 Subject: [PATCH] Make MDMF the default mutable format. refs ticket:2227 Signed-off-by: Daira Hopwood --- src/allmydata/client.py | 2 +- src/allmydata/mutable/layout.py | 2 +- src/allmydata/scripts/debug.py | 3 --- src/allmydata/web/directory.py | 18 +++++++++--------- src/allmydata/web/root.py | 24 ++++++++++++------------ src/allmydata/web/welcome.xhtml | 20 ++++++++++---------- 6 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index bb6dce23..c3b5beb7 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -382,7 +382,7 @@ class Client(node.Node, pollmixin.PollMixin): self.blacklist = Blacklist(fn) def init_nodemaker(self): - default = self.get_config("client", "mutable.format", default="SDMF") + default = self.get_config("client", "mutable.format", default="MDMF") if default.upper() == "MDMF": self.mutable_file_default = MDMF_VERSION else: diff --git a/src/allmydata/mutable/layout.py b/src/allmydata/mutable/layout.py index b938794f..492d48cb 100644 --- a/src/allmydata/mutable/layout.py +++ b/src/allmydata/mutable/layout.py @@ -74,7 +74,7 @@ OFFSETS_LENGTH = struct.calcsize(OFFSETS) MAX_MUTABLE_SHARE_SIZE = 69105*1000*1000*1000*1000 # 69105 TB, kind of arbitrary -# These are still used for some tests of SDMF files. +# These are still used for some tests. def unpack_header(data): o = {} (version, diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index 738f911e..a601594b 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -919,14 +919,11 @@ def corrupt_share(options): f = open(fn, "rb") f.seek(m.DATA_OFFSET) data = f.read(2000) - # make sure this slot contains an SMDF share - assert data[0] == "\x00", "non-SDMF mutable shares not supported" f.close() (version, ig_seqnum, ig_roothash, ig_IV, ig_k, ig_N, ig_segsize, ig_datalen, offsets) = unpack_header(data) - assert version == 0, "we only handle v0 SDMF files" start = m.DATA_OFFSET + offsets["share_data"] end = m.DATA_OFFSET + offsets["enc_privkey"] flip_bit(start, end) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index d82bf643..2f92841f 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -17,7 +17,7 @@ from allmydata.util.encodingutil import to_str from allmydata.uri import from_string_dirnode from allmydata.interfaces import IDirectoryNode, IFileNode, IFilesystemNode, \ IImmutableFileNode, IMutableFileNode, ExistingChildError, \ - NoSuchChildError, EmptyPathnameComponentError, SDMF_VERSION, MDMF_VERSION + NoSuchChildError, EmptyPathnameComponentError, MDMF_VERSION, SDMF_VERSION from allmydata.blacklist import ProhibitedNode from allmydata.monitor import Monitor, OperationCancelledError from allmydata import dirnode @@ -803,11 +803,11 @@ class DirectoryAsHTML(rend.Page): if self.dirnode_children is None: return T.div["No upload forms: directory is unreadable"] + mkdir_mdmf = T.input(type='radio', name='format', + value='mdmf', id='mkdir-mdmf') mkdir_sdmf = T.input(type='radio', name='format', value='sdmf', id='mkdir-sdmf', checked='checked') - mkdir_mdmf = T.input(type='radio', name='format', - value='mdmf', id='mkdir-mdmf') mkdir_form = T.form(action=".", method="post", enctype="multipart/form-data")[ @@ -818,8 +818,8 @@ class DirectoryAsHTML(rend.Page): "New directory name:"+SPACE, T.br, T.input(type="text", name="name"), SPACE, T.div(class_="form-inline")[ - mkdir_sdmf, T.label(for_='mutable-directory-sdmf')[SPACE, "SDMF"], SPACE*2, - mkdir_mdmf, T.label(for_='mutable-directory-mdmf')[SPACE, "MDMF (experimental)"] + mkdir_mdmf, T.label(for_='mutable-directory-mdmf')[SPACE, "MDMF"], SPACE*2, + mkdir_sdmf, T.label(for_='mutable-directory-sdmf')[SPACE, "SDMF"] ], T.input(type="submit", class_="btn", value="Create") ]] @@ -828,10 +828,10 @@ class DirectoryAsHTML(rend.Page): upload_chk = T.input(type='radio', name='format', value='chk', id='upload-chk', checked='checked') - upload_sdmf = T.input(type='radio', name='format', - value='sdmf', id='upload-sdmf') upload_mdmf = T.input(type='radio', name='format', value='mdmf', id='upload-mdmf') + upload_sdmf = T.input(type='radio', name='format', + value='sdmf', id='upload-sdmf') upload_form = T.form(action=".", method="post", enctype="multipart/form-data")[ @@ -843,8 +843,8 @@ class DirectoryAsHTML(rend.Page): T.input(type="file", name="file", class_="freeform-input-file"), SPACE, T.div(class_="form-inline")[ upload_chk, T.label(for_="upload-chk") [SPACE, "Immutable"], SPACE*2, - upload_sdmf, T.label(for_="upload-sdmf")[SPACE, "SDMF"], SPACE*2, - upload_mdmf, T.label(for_="upload-mdmf")[SPACE, "MDMF (experimental)"] + upload_mdmf, T.label(for_="upload-mdmf")[SPACE, "MDMF"], SPACE*2, + upload_sdmf, T.label(for_="upload-sdmf")[SPACE, "SDMF"] ], T.input(type="submit", class_="btn", value="Upload"), SPACE*2, ]] diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 8a9969c6..f4137eaa 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -348,15 +348,15 @@ class Root(rend.Page): def render_upload_form(self, ctx, data): # This is a form where users can upload unlinked files. - # Users can choose immutable, SDMF, or MDMF from a radio button. + # Users can choose immutable, MDMF, or SDMF from a radio button. upload_chk = T.input(type='radio', name='format', value='chk', id='upload-chk', checked='checked') - upload_sdmf = T.input(type='radio', name='format', - value='sdmf', id='upload-sdmf') upload_mdmf = T.input(type='radio', name='format', value='mdmf', id='upload-mdmf') + upload_sdmf = T.input(type='radio', name='format', + value='sdmf', id='upload-sdmf') form = T.form(action="uri", method="post", enctype="multipart/form-data")[ @@ -365,9 +365,9 @@ class Root(rend.Page): T.div["Choose a file:"+SPACE, T.input(type="file", name="file", class_="freeform-input-file")], T.input(type="hidden", name="t", value="upload"), - T.div[upload_chk, T.label(for_="upload-chk") [" Immutable"], SPACE, - upload_sdmf, T.label(for_="upload-sdmf")[" SDMF"], SPACE, - upload_mdmf, T.label(for_="upload-mdmf")[" MDMF (experimental)"], SPACE*2, + T.div[upload_chk, T.label(for_="upload-chk") [" Immutable"], SPACE, + upload_mdmf, T.label(for_="upload-mdmf")[" MDMF"], SPACE, + upload_sdmf, T.label(for_="upload-sdmf")[" SDMF"], SPACE*2, T.input(type="submit", value="Upload!")], ]] return T.div[form] @@ -376,18 +376,18 @@ class Root(rend.Page): # This is a form where users can create new directories. # Users can choose SDMF or MDMF from a radio button. - mkdir_sdmf = T.input(type='radio', name='format', - value='sdmf', id='mkdir-sdmf', - checked='checked') mkdir_mdmf = T.input(type='radio', name='format', - value='mdmf', id='mkdir-mdmf') + value='mdmf', id='mkdir-mdmf', + checked='checked') + mkdir_sdmf = T.input(type='radio', name='format', + value='sdmf', id='mkdir-sdmf') form = T.form(action="uri", method="post", enctype="multipart/form-data")[ T.fieldset[ T.legend(class_="freeform-form-label")["Create a directory"], - mkdir_sdmf, T.label(for_='mkdir-sdmf')[" SDMF"], SPACE, - mkdir_mdmf, T.label(for_='mkdir-mdmf')[" MDMF (experimental)"], SPACE*2, + mkdir_mdmf, T.label(for_='mkdir-mdmf')[" MDMF"], SPACE, + mkdir_sdmf, T.label(for_='mkdir-sdmf')[" SDMF"], SPACE*2, T.input(type="hidden", name="t", value="mkdir"), T.input(type="hidden", name="redirect_to_result", value="true"), T.input(type="submit", value="Create a directory"), diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml index 3e23fc73..c2b0cb27 100644 --- a/src/allmydata/web/welcome.xhtml +++ b/src/allmydata/web/welcome.xhtml @@ -76,16 +76,16 @@ Immutable + + - -

@@ -94,16 +94,16 @@