Philip Martin wrote:
> The current Ev2 has atomic add for files and directories, it doesn't
> attempt to reuse the alter operations by adding "empty" nodes and then
> altering those empty nodes.  The current Ev2 also has move and copy
> operations that do attempt to resuse alter.  I'm not clear why they are
> different.  Why is add different from move/copy?

I agree there's incomplete separation of concerns in these aspects of the API.  
I don't know whether that's a problem.

> We could split move in two and make the parts more like delete and
> add. We could also make copy more like add:
> 
>     add_file(path, properties, content, replaces_rev)
>     add_dir(path, properties, children, replaces_rev)
>     alter_file(path, properties, content, replaces_rev)
>     alter_dir(path, properties, children, replaces_rev)
>     delete(path, revision)
>     move_away(src_path, dst_path, revision)
>     move_here_file(src_path, dst_path, properties, content, replaces_rev)
>     move_here_dir(src_path, dst_path, properties, children, replaces_rev)
>     copy_file(src_path, src_rev, dst_path, properties, content, replaces_rev)
>     copy_dir(src_path, src_rev, dst_path, properties, children, replaces_rev)

Yup.  Alternatively, we could make 'alter' the *only* way to declare a node's 
content:

  add_file(path)  # new empty file
  add_dir(path)   # new empty dir
  copy(src_path, dst_path)
  move(...)
  alter_file(path, properties, content, replaces_rev)
  alter_dir(path, properties, children, replaces_rev)

Or with just a single add_ function:

  add_node(path)  # declare new node; its kind to be set by alter_*.
  copy(src_path, dst_path)
  move(...)
  alter_file(path, properties, content, replaces_rev)
  alter_dir(path, properties, children, replaces_rev)

- Julian

Reply via email to