[tahoe-lafs-trac-stream] [tahoe-lafs] #1732: consider changes to webapi "Move" API before release

tahoe-lafs trac at tahoe-lafs.org
Mon Mar 18 20:33:09 UTC 2013


#1732: consider changes to webapi "Move" API before release
-------------------------------+-------------------------------------------
     Reporter:  warner         |      Owner:  warner
         Type:  enhancement    |     Status:  new
     Priority:  major          |  Milestone:  1.10.0
    Component:  code-          |    Version:  1.9.1
  frontend-web                 |   Keywords:  forward-compatibility blocker
   Resolution:                 |
Launchpad Bug:                 |
-------------------------------+-------------------------------------------

Comment (by davidsarah):

 Oh, I've had another idea. What if we just generalize {{{t=rename}}} so
 that it can take an optional {{{to_dir}}} parameter? I.e.:

 {{{
 Moving or Renaming a Child
 --------------------------

 ``POST /uri/$DIRCAP/[SUBDIRS../]?t=rename&from_name=OLD
 [&to_dir=$NEWDIRCAP/[NEWSUBDIRS../][&to_name=NEW][&replace=true|false
 |only-files]``

  This instructs the node to move or rename a child of the given directory,
  which must be writeable. If {{{to_dir}}} is present, the child is moved
  into the directory specified by {{{to_dir}}}, which must also be
 writeable.
  If {{{to_dir}}} is not present, the child is renamed within the same
 directory.
  If {{{to_name}}} is not present then it defaults to {{{from_name}}}.
  If the destination directory and name are the same as the source, the
  operation has no effect.

  Metadata from the source directory entry is preserved. Multiple levels of
  descent in the source and destination paths are supported.

  This operation will return an HTTP 404 "Not Found" error if
  ``$DIRCAP/[SUBDIRS../]``, the child being moved, or {{{to_dir}}} (if
 given)
  does not exist. It will return an HTTP 400 "Bad Request" error if any
  entry in the source of destination paths is not a directory.

  The default behavior is to overwrite any existing object at the given
  location (replace=true). To prevent this (and make the operation return
  an error instead of overwriting), add a "replace=false" argument. With
  replace=false, this operation will return an HTTP 409 "Conflict" error if
  there is already an object at the given location, rather than overwriting
  the existing object. To allow the operation to overwrite a file, but
  return an HTTP 409 error when trying to overwrite a directory, use
  "replace=only-files" (this behavior is closer to the traditional UNIX
 "mv"
  command). Note that "true", "t", and "1" are all synonyms for "True";
  "false", "f", and "0" are synonyms for "False"; and the parameter is
  case-insensitive.

  When moving to a different directory, for safety, the child is not
 unlinked
  from the old directory until it has been successfully added to the new
  directory. This implies that in case of a crash or failure, the child
 will
  not be lost, but could be linked at both the old and new locations.

  Prior to Tahoe-LAFS v1.10, the {{{to_dir}}} parameter and the
  {{{replace=only-files}}} option were not supported.
 }}}

-- 
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1732#comment:32>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list