Changes between Initial Version and Version 5 of Ticket #1526


Ignore:
Timestamp:
2011-09-04T22:09:23Z (13 years ago)
Author:
davidsarah
Comment:

[Description edited to merge in comments from the duplicate #1509, and take into account comment:1.]

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1526 – Description

    initial v5  
    55I thought we had decided to make a generic field for "extensions" in the MDMF caps, and not to make the current (1.9) reader or writer actually use this extension field yet. But the current code in trunk constrains that field instead of allowing it to be generically extensible, and it seems to try to use the numbers contained therein for its {{{K}}} and {{{segsize}}} values in some (?) cases.
    66
    7 As for the constraints, first it constrains the extension field to [source:trunk/src/allmydata/uri.py?annotate=blame&rev=5220#L31 contain only the characters 0-9 and :], and then it requires it to be [source:trunk/src/allmydata/mutable/filenode.py?annotate=blame&rev=5227#L120 exactly two elements long].
     7The MDMF filecap format is currently defined as:
    88
    9 Future versions of MDMF writers can't use the extension field then, to communicate anything which isn't made up of {{{0-9}}} characters and exactly one {{{:}}} character. It might allow some future use if it is instead a less constrained field which can have a larger set of characters, and which has space in it for messages that Tahoe-LAFS v1.9 readers will parse and then ignore.
     9{{{
     10  URI:MDMF:$writekey:$fingerprint[(:$extension)*]
     11}}}
    1012
    11 As for the use of that field to initialize the {{{K}}} and {{{segsize}}} values, I haven't read through the code carefully enough to see if it does that correctly and if it has good tests. If we're going to keep the code in there that uses those values for download, then it probably makes sense to add the code which writes those values into the cap on upload!
     13and all existing caps are created with two extension fields: the first is K (as an integer), the second is segsize (also as an integer). The intention is to allow additional extension fields to be added in the future, perhaps hints that could speed up a download.
    1214
    13 That latter part—putting the {{{K}}} and {{{segsize}}} into the cap when generating the cap when writing—is very simple to do, whereas the former part is potentially complicated.
     15But the current code first constrains each extension field to [source:trunk/src/allmydata/uri.py?annotate=blame&rev=5220#L31 contain only the characters 0-9 and :], and then it requires there to be [source:trunk/src/allmydata/mutable/filenode.py?annotate=blame&rev=5227#L120 exactly two such fields].
     16
     17Future versions of MDMF writers can't use the extensions then, to communicate anything other than the currently defined K and segsize fields. They might allow some future use if each field can have a larger set of characters, and if there is space for messages that Tahoe-LAFS v1.9 readers will parse and then ignore.
     18
     19I'd like to have this in 1.9 because then 1.9 will be tolerant of caps generated by future versions that have a different number of extension fields.
     20
     21As for the use of that field to initialize the {{{K}}} and {{{segsize}}} values, I haven't read through the code carefully enough to see if it does that correctly and if it has good tests. This is potentially complicated.
    1422
    1523What, for example, happens if the {{{segsize}}} indicated in the cap and the {{{segsize}}} indicated [source:trunk/src/allmydata/mutable/filenode.py?annotate=blame&rev=5227#L1107 in the version info] differ? Can the {{{segsize}}} or the {{{K}}} change in different versions of the same MDMF? (I'm pretty sure it can't, but if it can't then maybe the value in the cap should be the ''only'' place that {{{K}}} or {{{segsize}}} exist.) Does the current trunk MDMF reader actually really use this value? Scanning through the code, I don't think so but I'm not 100% sure yet.
     
    2129* 1. a. Loosen the constraint-checking on the extension field in MDMF caps to allow a larger character class and have almost no constraints except those necessary for safe and easy parsing to find where the field begins and ends.
    2230* 1. b. Eliminate all code which uses the contents of the extension field when reading.
    23 * 1. c. [OPTIONAL] Write code (if it isn't already there) to populate the contents of that extension field with {{{K:segsize}}} when generating a URL. (The way it encodes {{{K}}} and {{{segsize}}} into the extension field has, of course, to fit into the constraints of the extension field. In addition to that, it should ''not'' consume the entire extension field, but should allow a safe and easy way for other fields to be added into the extension field such that they can be unambiguously parsed apart from the {{{K}}} and {{{segsize}}} fields.)
     31* 1. c. Reconsider whether to populate the contents of that extension field with {{{K:segsize}}} when generating a URL. (The way {{{K}}} and {{{segsize}}} are encoded into the extension field has, of course, to fit into the constraints of the extension field. In addition to that, it should ''not'' consume the entire extension field, but should allow a safe and easy way for other fields to be added into the extension field such that they can be unambiguously parsed apart from the {{{K}}} and {{{segsize}}} fields.)
    2432* 1. d. Think about whether this proposal will lead to unsafety/insecurity or forward-compatibility problems.
    2533
     
    2836* 2. a. Define part of the MDMF cap to hold {{{K}}} and {{{segsize}}}. This is in fact exactly the same as the "extension field" in the current trunk, but we stop calling it the "extension field" and start calling it {{{K}}} and {{{segsize}}}.
    2937* 2. b. Eliminate all code which uses {{{K}}} and {{{segsize}}} values from anywhere ''other'' than the cap when reading.
    30 * 2. c. Write code (if it isn't already there) to populate the contents of the {{{K}}} and {{{segsize}}} parts of the MDMF cap when generating a cap.
    31 * 2. d. Think about whether this proposal will lead to unsafety/insecurity or forward-compatibility problems.
     38* 2. c. Think about whether this proposal will lead to unsafety/insecurity or forward-compatibility problems.
    3239
    3340Proposal 3 ({{{K}}} and {{{segsize}}} in cap, plus an extension field):
    3441
    35 * Do all of Proposal 2 to encode {{{K}}} and {{{segsize}}} into the cap, and then also do proposal 1 (except for 1.c. of course) to provide an extension field for future use.
     42* Do all of Proposal 2 to encode {{{K}}} and {{{segsize}}} into the cap, and then also do proposal 1.a. to provide an extension field for future use.
    3643
    37 I think that Proposal 1 is the least likely to delay or destabilize Tahoe-LAFS v1.9, especially if we leave out the optional 1.c. step. If v1.9 does not attempt to use the extension field in any way other than telling where it begins and ends, then future MDMF users will not have to worry that what they put in there will cause problems for old v1.9 users. By removing all the code that does anything with the extension field (aside from the regex which allows the extension field to be present in an MDMF cap), we can simplify the current 1.9 alpha code for easier review.
     44[Note: Zooko was talking below about slightly different versions of the proposals -- he wasn't sure whether the existing code included K and segsize, which in fact it does.]
     45
     46I think that Proposal 1 is the least likely to delay or destabilize Tahoe-LAFS v1.9 ~~especially if we leave out the optional 1.c. step~~. If v1.9 does not attempt to use the extension field in any way other than telling where it begins and ends, then future MDMF users will not have to worry that what they put in there will cause problems for old v1.9 users. By removing all the code that does anything with the extension field (aside from the regex which allows the extension field to be present in an MDMF cap), we can simplify the current 1.9 alpha code for easier review.
    3847
    3948I'd like to hear your opinion about this! (Especially if you are Kevan, David-Sarah, or Brian.)