Ticket #1552: add-format-docs.darcs.patch

File add-format-docs.darcs.patch, 11.9 KB (added by kevan, at 2011-10-10T04:07:58Z)

add documentation for the format argument to webapi.rst

Line 
1Sun Oct  9 19:55:29 PDT 2011  kevan@isnotajoke.com
2  * docs/frontends/webapi.rst: document the format argument
3
4New patches:
5
6[docs/frontends/webapi.rst: document the format argument
7kevan@isnotajoke.com**20111010025529
8 Ignore-this: 2a7b8d711dc369bd9a23e2853824cfb0
9] {
10hunk ./docs/frontends/webapi.rst 381
11  file is replaced with the data from the HTTP request body. For an
12  immutable file, the "offset" parameter is not valid.
13 
14- When creating a new file, if "mutable=true" is in the query arguments, the
15- operation will create a mutable file instead of an immutable one.
16+ When creating a new file, you can control the type of file created by
17+ specifying a format= argument in the query string. format=mdmf creates an MDMF
18+ mutable file. format=sdmf creates an SDMF mutable file. format=chk creates an
19+ immutable file. The value of the format argument is case-insensitive. For
20+ compatibility with previous versions of Tahoe-LAFS, the webapi will also
21+ accept a mutable=true argument in the query string. If mutable=true is given,
22+ then the new file will be mutable, and its format will be the default mutable
23+ file format, as configured on the Tahoe-LAFS node hosting the webapi server.
24+ Use of mutable=true is discouraged; new code should use format= instead of
25+ mutable=true.  If neither format= nor mutable=true are given, the
26+ newly-created file will be immutable.
27 
28  This returns the file-cap of the resulting file. If a new file was created
29  by this method, the HTTP response code (as dictated by rfc2616) will be set
30hunk ./docs/frontends/webapi.rst 407
31  attach the file into the filesystem. No directories will be modified by
32  this operation. The file-cap is returned as the body of the HTTP response.
33 
34- If "mutable=true" is in the query arguments, the operation will create a
35- mutable file, and return its write-cap in the HTTP respose. The default is
36- to create an immutable file, returning the read-cap as a response. If
37- you create a mutable file, you can also use the "mutable-type" query
38- parameter. If "mutable-type=sdmf", then the mutable file will be created
39- in the old SDMF mutable file format. This is desirable for files that
40- need to be read by old clients. If "mutable-type=mdmf", then the file
41- will be created in the new MDMF mutable file format. MDMF mutable files
42- can be downloaded more efficiently, and modified in-place efficiently,
43- but are not compatible with older versions of Tahoe-LAFS. If no
44- "mutable-type" argument is given, the file is created in whatever
45- format was configured in tahoe.cfg.
46-
47+ This method accepts format= and mutable=true as query string arguments, and
48+ interprets those arguments in the same way as the linked forms of PUT
49+ described immediately above.
50 
51 Creating A New Directory
52 ------------------------
53hunk ./docs/frontends/webapi.rst 423
54  filesystem. The "PUT" operation is provided for backwards compatibility:
55  new code should use POST.
56 
57+ This supports a format= argument in the query string. The format=
58+ argument, if specified, controls the format of the directory. format=mdmf
59+ indicates that the directory should be stored as an MDMF file; format=sdmf
60+ indicates that the directory should be stored as an SDMF file. The value of
61+ the format= argument is case-insensitive. If no format= argument is
62+ given, the directory's format is determined by the default mutable file
63+ format, as configured on the Tahoe-LAFS node responding to the request.
64+
65 ``POST /uri?t=mkdir-with-children``
66 
67  Create a new directory, populated with a set of child nodes, and return its
68hunk ./docs/frontends/webapi.rst 437
69  write-cap as the HTTP response body. The new directory is not attached to
70  any other directory: the returned write-cap is the only reference to it.
71 
72+ The format of the directory can be controlled with the format= argument in
73+ the query string, as described above.
74+
75  Initial children are provided as the body of the POST form (this is more
76  efficient than doing separate mkdir and set_children operations). If the
77  body is empty, the new directory will be empty. If not empty, the body will
78hunk ./docs/frontends/webapi.rst 551
79 
80  If the final directory is created, it will be empty.
81 
82+ This accepts a format= argument in the query string, which controls the
83+ format of the named target directory, if it does not already exist. format=
84+ is interpreted in the same way as in the POST /uri?t=mkdir form. Note that
85+ format= only controls the format of the named target directory;
86+ intermediate directories, if created, are created based on the default
87+ mutable type, as configured on the Tahoe-LAFS server responding to the
88+ request.
89+
90  This operation will return an error if a blocking file is present at any of
91  the parent names, preventing the server from creating the necessary parent
92  directory; or if it would require changing an immutable directory.
93hunk ./docs/frontends/webapi.rst 573
94  intermediate mutable directories as necessary. If the final directory is
95  created, it will be populated with initial children from the POST request
96  body, as described above.
97+
98+ This accepts a format= argument in the query string, which controls the
99+ format of the target directory, if the target directory is created as part
100+ of the operation. format= is interpreted in the same way as in the POST/
101+ uri?t=mkdir-with-children operation. Note that format= only controls the
102+ format of the named target directory; intermediate directories, if created,
103+ are created using the default mutable type setting, as configured on the
104+ Tahoe-LAFS server responding to the request.
105 
106  This operation will return an error if a blocking file is present at any of
107  the parent names, preventing the server from creating the necessary parent
108hunk ./docs/frontends/webapi.rst 605
109  Create a new empty mutable directory and attach it to the given existing
110  directory. This will create additional intermediate directories as necessary.
111 
112+ This accepts a format= argument in the query string, which controls the
113+ format of the named target directory, if it does not already exist. format=
114+ is interpreted in the same way as in the POST /uri?t=mkdir form. Note that
115+ format= only controls the format of the named target directory;
116+ intermediate directories, if created, are created based on the default
117+ mutable type, as configured on the Tahoe-LAFS server responding to the
118+ request.
119+
120  This operation will return an error if a blocking file is present at any of
121  the parent names, preventing the server from creating the necessary parent
122  directory, or if it would require changing any immutable directory.
123hunk ./docs/frontends/webapi.rst 626
124  Like /uri/$DIRCAP/[SUBDIRS../]?t=mkdir&name=NAME, but the new directory will
125  be populated with initial children via the POST request body. This command
126  will create additional intermediate mutable directories as necessary.
127-
128+
129+ This accepts a format= argument in the query string, which controls the
130+ format of the target directory, if the target directory is created as part
131+ of the operation. format= is interpreted in the same way as in the POST/
132+ uri?t=mkdir-with-children operation. Note that format= only controls the
133+ format of the named target directory; intermediate directories, if created,
134+ are created using the default mutable type setting, as configured on the
135+ Tahoe-LAFS server responding to the request.
136+
137  This operation will return an error if a blocking file is present at any of
138  the parent names, preventing the server from creating the necessary parent
139  directory; or if it would require changing an immutable directory; or if
140hunk ./docs/frontends/webapi.rst 680
141         "ro_uri": file_uri,
142         "verify_uri": verify_uri,
143         "size": bytes,
144-        "mutable": false
145+        "mutable": false,
146+     "format": "chk"
147         } ]
148 
149  If it is a capability to a directory followed by a path from that directory
150hunk ./docs/frontends/webapi.rst 695
151         "verify_uri": verify_uri,
152         "size": bytes,
153         "mutable": false,
154+     "format": "chk",
155         "metadata": {
156           "ctime": 1202777696.7564139,
157           "mtime": 1202777696.7564139,
158hunk ./docs/frontends/webapi.rst 719
159         "ro_uri": read_only_uri,
160         "verify_uri": verify_uri,
161         "mutable": true,
162+     "format": "sdmf",
163         "children": {
164           "foo.txt": [ "filenode", {
165                   "ro_uri": uri,
166hunk ./docs/frontends/webapi.rst 1079
167  * access caps (URIs): verify-cap, read-cap, write-cap (for mutable objects)
168  * check/verify/repair form
169  * deep-check/deep-size/deep-stats/manifest (for directories)
170- * replace-conents form (for mutable files)
171+ * replace-contents form (for mutable files)
172 
173 
174 Creating a Directory
175hunk ./docs/frontends/webapi.rst 1099
176  /uri/$DIRCAP page. There is a "create directory" button on the Welcome page
177  to invoke this action.
178 
179+ This accepts a format= argument in the query string. Refer to the
180+ documentation of the PUT /uri?t=mkdir operation in `Creating A
181+ New Directory`_ for information on the behavior of the format= argument.
182+
183  If "redirect_to_result=true" is not provided (or is given a value of
184  "false"), then the HTTP response body will simply be the write-cap of the
185  new directory.
186hunk ./docs/frontends/webapi.rst 1112
187  This creates a new empty directory as a child of the designated SUBDIR. This
188  will create additional intermediate directories as necessary.
189 
190+ This accepts a format= argument in the query string. Refer to the
191+ documentation of POST /uri/$DIRCAP/[SUBDIRS../]?t=mkdir&name=CHILDNAME in
192+ `Creating A New Directory`_ for information on the behavior of the format=
193+ argument.
194+
195  If a "when_done=URL" argument is provided, the HTTP response will cause the
196  web browser to redirect to the given URL. This provides a convenient way to
197  return the browser to the directory that was just modified. Without a
198hunk ./docs/frontends/webapi.rst 1153
199  about which storage servers were used for the upload, how long each
200  operation took, etc.
201 
202- If a "mutable=true" argument is provided, the operation will create a
203- mutable file, and the response body will contain the write-cap instead of
204- the upload results page. The default is to create an immutable file,
205- returning the upload results page as a response. If you create a
206- mutable file, you may choose to specify the format of that mutable file
207- with the "mutable-type" parameter. If "mutable-type=mdmf", then the
208- file will be created as an MDMF mutable file. If "mutable-type=sdmf",
209- then the file will be created as an SDMF mutable file. If no value is
210- specified, the file will be created in whatever format is specified in
211- tahoe.cfg.
212-
213+ This accepts format= and mutable=true query string arguments. Refer to
214+ `Writing/Uploading A File`_ for information on the behavior of format= and
215+ mutable=true.
216 
217 ``POST /uri/$DIRCAP/[SUBDIRS../]?t=upload``
218 
219hunk ./docs/frontends/webapi.rst 1191
220  /uri/$DIRCAP/[SUBDIRS../]", it is likely that the parent directory will
221  already exist.
222 
223- If a "mutable=true" argument is provided, any new file that is created will
224- be a mutable file instead of an immutable one. <input type="checkbox"
225- name="mutable" /> will give the user a way to set this option.
226+ This accepts format= and mutable=true query string arguments. Refer to
227+ `Writing/Uploading A File`_ for information on the behavior of format= and
228+ mutable=true.
229 
230  If a "when_done=URL" argument is provided, the HTTP response will cause the
231  web browser to redirect to the given URL. This provides a convenient way to
232}
233
234Context:
235
236[test/test_runner.py: BinTahoe.test_path has rare nondeterministic failures; this patch probably fixes a problem where the actual cause of failure is masked by a string conversion error.
237david-sarah@jacaranda.org**20110927225336
238 Ignore-this: 6f1ad68004194cc9cea55ace3745e4af
239]
240[docs/configuration.rst: add section about the types of node, and clarify when setting web.port enables web-API service. fixes #1444
241zooko@zooko.com**20110926203801
242 Ignore-this: ab94d470c68e720101a7ff3c207a719e
243]
244[TAG allmydata-tahoe-1.9.0a2
245warner@lothar.com**20110925234811
246 Ignore-this: e9649c58f9c9017a7d55008938dba64f
247]
248Patch bundle hash:
2490bf59c7eb21cf2d6d01229724790cb192b8ae0b0