jacquayj / GoRODS

Golang binding for iRODS C API: An iRODS client library written in Golang + C
https://godoc.org/github.com/jjacquay712/GoRODS
BSD 3-Clause "New" or "Revised" License
17 stars 5 forks source link

Implement Collection.Delete() #13

Closed simont closed 8 years ago

simont commented 8 years ago

Following on from the ability to create collections, we're going to need to be able to delete collections from iRODS, similar to the iRODS irm function.

https://docs.irods.org/4.1.8/icommands/user/#irm

Likely options we'll need would include:

The method signature might be something like this:

func (col *Collection) Delete(force bool, recursive bool) error

S.

jjacquay712 commented 8 years ago

No recursive flag when deleting collection with sub collections or data objects might fail... I'll need to look into this since I don't know the behavior. I like your proposed interface, and maybe there could be other helper functions that have force and recursive defaults defined.

jjacquay712 commented 8 years ago
$ irm -f test-dir
ERROR: rmCollUtil: -r option must be used for collection /tempZone/home/admin/test-dir
ERROR: rmUtil: rm error for /tempZone/home/admin/test-dir, status = -318000 status = -318000 USER_INPUT_OPTION_ERR

"irm" without the recursive flag on a collection fails, regardless of contents.

Note: Also need to consider "irmtrash" functionality.

jjacquay712 commented 8 years ago

Proposed IRodsObj interface additions:

// irm -rf
Destroy() error

// irm -f {-r}
Delete(recursive bool) error

// irm {-r}
Trash(recursive bool) error

// irm {-r} {-f}
Rm(recursive bool, force bool) error