flux_future_t *flux_kvs_copy (flux_t *h, const char *srckey, const char *dstkey, int commit_flags);
flux_future_t *flux_kvs_move (flux_t *h, const char *srckey, const char *dstkey, int commit_flags);
flux_kvs_copy() sends a request via handle h to the KVS service
to look up the directory entry of srckey. Upon receipt of the response,
it then sends another request to commit a duplicate at dstkey.
commit_flags are passed through to the commit operation.
See the FLAGS section of flux_kvs_commit(3).
The net effect is that all content below srckey is copied to dstkey. Due to the hash tree organization of the KVS name space, only the directory entry needs to be duplicated to create a new, fully independent deep copy of the original data.
flux_kvs_move() first performs a
flux_kvs_copy(), then sends a
commit request to unlink srckey. commit_flags are passed through to
the commit within
flux_kvs_copy(), and to the commit which performs
flux_kvs_move() are capable of working across
namespaces. See flux_kvs_commit(3) for info on how to select a
namespace other than the default.
flux_kvs_commit() are implemented as aggregates
of multiple KVS operations. As such they do not have the "all or nothing"
guarantee of a being carried out within a single KVS transaction.
In the unlikely event that the copy phase of a
succeeds but the unlink phase fails,
flux_kvs_move() may return failure
without cleaning up the new copy. Since the copy phase already validated
that the unlink target key exists by copying from it, the source of such a
failure would be a transient error such as out of memory or communication
flux_kvs_copy () and
flux_kvs_move () return a
success, or NULL on failure with errno set appropriately.
One of the arguments was invalid.
Out of memory.
A request was malformed.
The KVS module is not loaded.
An unknown namespace was requested.