On Mon, Feb 7, 2011 at 7:42 PM, Chris Webb <chris at arachsys.com> wrote: >> > In an ideal world, it would be good to have some sort of >> > no-clobber/exclusive mechanism too. For example: >> > >> > $ collie vdi setdata [key] [value] exclusive >> > >> > which if [key] is unset, sets it to value [value], or if it is set, fails >> > with non-zero exit code. (This could be used by a management layer to >> > implement exclusive access to drives, for example.) >> >> Yes, it would be useful to have the feature. > > Perhaps a -x argument to specify exclusive/no-clobber behaviour, so the > final syntax might be > > $ collie vdi getattr KEY > $ collie vdi setattr KEY [-x] < VALUEFILE > $ collie vdi setattr KEY [-x] VALUE > $ collie vdi setattr KEY -d > > with getattr returning the value on STDOUT and exit status 0, or exit status > != 0 if the key doesn't exist, and setattr returning exit status != 0 if the > key does exist and -x is given. Looks good to me. I'll implement those soon. :-) Thanks, Kazutaka |