wapi: add mkdir-with-children #533
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#533
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
the "tahoe cp -r" command would benefit from this: instead of two operations (mkdir, set-children), we could create the directory in a single frontend call. This would be faster on the backend too, basically create-mutable-file with initial contents, instead of a create-empty-mutable-file followed by a modify.
This API could also be used for immutable dirnodes.
The initial children would be provided as a JSON-encoded PUT body or POST
field to the existing t=mkdir operation. The syntax for this would be as
follows:
Creating A New Directory
POST /uri?t=mkdir
PUT /uri?t=mkdir
Create a new directory (either empty or with some initial children) and
return its write-cap as the HTTP response body. This does not make the newly
created directory visible from the virtual drive. The "PUT" operation is
provided for backwards compatibility: new code should use POST.
If the request body of the PUT is empty, the new directory will be empty.
If the request body of the PUT is non-empty, it will be interpreted as a
JSON-encoded list of children with which the new directory should be
populated. This is more efficient than doing separate mkdir and add-children
operations. Each entry in the list should be a list of (child-name,
child-URI, metadata-dict). For example, the body could be:
POST /uri/$DIRCAP/SUBDIRS../SUBDIR?t=mkdir
PUT /uri/$DIRCAP/SUBDIRS../SUBDIR?t=mkdir
Create new directories as necessary to make sure that the named target
($DIRCAP/SUBDIRS../SUBDIR) is a directory. This will create additional
intermediate directories as necessary. If the named target directory already
exists, this will make no changes to it.
Initial children can be provided as the request body of the PUT, or as a
"children" field of the POST form. In both cases the initial children are
provided as a JSON-encoded list of (name, URI, metadata) tuples. If the PUT
request body is empty, or if the POST form has no 'children' field, then the
new directory will be empty.
This will return an error if a blocking file is present at any of the parent
names, preventing the server from creating the necessary parent directory.
The write-cap of the new directory will be returned as the HTTP response
body.
POST /uri/$DIRCAP/SUBDIRS../?t=mkdir&name=NAME
Create a new directory and attach it to the given existing directory. This
will create additional intermediate directories as necessary.
Initial children can be provided as a "children" field of the POST form, in
a JSON-encoded list of (name, URI, metadata) tuples. If the POST form has no
'children' field, then the new directory will be empty.
The URL of this form points to the parent of the bottom-most new directory,
whereas the previous form has a URL that points directly to the bottom-most
new directory.
I implemented this in changeset:768c76aa5fbe2c7f, using (safer) t=mkdir-with-children instead of (unsafe) just adding an argument to the old t=mkdir (which would cause problems when a new client sent ignored arguments to an old webapi server).
"cp -r" and "tahoe backup" do not yet use this API, though. (see #828 for that part)
I just updated t=mkdir-with-children to accept the JSON dictionary of children as the full POST request body, rather than as the children= portion of a multipart/form body. This should be a lot easier to use.
Finally closing this ticket. #828 is still open (to update the CLI commands to use the new API).
wapi: add mkdir-with-initial-childrento wapi: add mkdir-with-children