-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rework KVS interface #1094
Comments
I think I'd like to see a term other than "putf", since the format doesn't match what we'd expect to see in all of the other "f" functions in the standard C library. |
I thought "verb+f" was probably the expected form. What would you suggest? |
Would we want to return
We could probably just wrap the get & destroy in |
As suggested in #353, Is it useful to treat the result as a flat list of fully qualified keys that can be iterated over and individually accessed? For example: const char *flux_kvs_lookup_first (flux_future_t *f);
const char *flux_kvs_lookup_next (flux_future_t *f); and then add a key parameter to get, e.g.: int flux_kvs_lookup_get (flux_future_t *f, const char *key, const char **json_str);
int flux_kvs_lookup_getf (flux_future_t *f, const char *key, const char *fmt, ...); Or do we need something more like libutil/dirwalk? |
@chu11, hopefully users are actually using the reactive model (especially in modules), so I would assume the common case is more like: f = flux_kvs_put (...);
flux_future_then (f, 0, handle_error, NULL);
/* Back to event loop */ |
That's how the current API works, and the problem is that it forces the user to make a synchronous RPC, which is not good practice in reactor context. It's better to expose the future and let the user decide IMHO. |
Yeah, I guess I was thinking common case like the |
Would it work to get some kind of kvs-specific object from the future_t, instead of operating directly on the future? That way, you can implement something recursive without returning a future_t from a future_t. E.g. I'm not sure if this is a good or dumb idea actually. |
I would expect that function to operate like printf, or scanf, or any of the others. But that's not how it works, right? It is going to be jansson-style formatting. So...anything but named like the C formatting functions would be fine with me. |
Maybe instead of |
That's a good point (that the txn interface already exposes the future). I don't know I guess I could go either way on that one. It's certainly true that replacing existing I lean towards keeping it this way, but I'm not strongly committed if other people felt differently. |
Yeah, I'm not sure what would be better. If we come up with something better we should open an issue to go back and fix the various payload encode/decode functions in message.h, request.h, response.h, event.h, rpc.h, mrpc.h, etc. to be consistent. |
I'm not sure it would inflate code too much -- something like flux-kvs that is dead set on using all synchronous calls could just include a few short static wrapper functions and the rest of the code would remain the same. My opinion is it is probably good to vector users toward reactive programming model anyway, and therefore the "convenience" functions should be at least usable by default in that mode. |
How about: flux_kvs_txn_putp() p for pack. But I'm not tied to that. Really, anything that avoids misleading me into thinking I can do "%d" would be fine. |
Not bad... although it telegraphs something else to LISP people (beerP?) |
It may be least confusing to just append We would want to go back through the flux API and make all the variadic message parsing functions look the same, e.g.
It's more verbose, but if it improves clarity, maybe an improvement... |
Could probably drop the "set_json/get_json" portion in the flux_msg functions above actually, e.g. |
Er, I should have said "vpack" not "pack_ex". The jansson function that accepts a va_list argument is Sorry for the monologue. |
Rename flux_kvs_lookup_getf() to flux_kvs_lookup_unpack() per discussion in flux-framework#1094. Update users in flux-kvs, libjsc, resource-hwloc module, wrexecd, and KVS tests.
Rename flux_msg_set_jsonf() to flux_msg_pack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_msg_vset_jsonf() to flux_msg_vpack() per discussion in flux-framework#1094. Update users in libflux message encoding functions.
Rename flux_msg_get_jsonf() to flux_msg_unpack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_msg_vget_jsonf() to flux_msg_vunpack() per discussion in flux-framework#1094. Update users in libflux message decoding functions.
Rename flux_rpcf() to flux_rpc_pack() per discussion in flux-framework#1094. Update users across flux-core, and unit tests.
Rename flux_rpc_getf() to flux_rpc_get_unpack() per discussion in flux-framework#1094. Update users across flux-core, and unit tests.
Rename flux_event_decodef() to flux_event_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, barrier module, and broker.
Rename flux_event_encodef() to flux_event_pack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, wreck job module, wrexecd, and broker.
Rename flux_request_decodef() to flux_request_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, broker, and various modules.
Rename flux_msg_get_jsonf() to flux_msg_unpack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_event_decodef() to flux_event_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, barrier module, and broker.
Rename flux_event_encodef() to flux_event_pack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, wreck job module, wrexecd, and broker.
Rename flux_request_decodef() to flux_request_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, broker, and various modules.
Rename flux_kvs_lookup_getf() to flux_kvs_lookup_get_unpack() per discussion in flux-framework#1094. Update users in flux-kvs, libjsc, resource-hwloc module, wrexecd, and KVS tests.
Rename flux_msg_set_jsonf() to flux_msg_pack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_msg_vset_jsonf() to flux_msg_vpack() per discussion in flux-framework#1094. Update users in libflux message encoding functions.
Rename flux_msg_get_jsonf() to flux_msg_unpack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_msg_vget_jsonf() to flux_msg_vunpack() per discussion in flux-framework#1094. Update users in libflux message decoding functions.
Rename flux_rpcf() to flux_rpc_pack() per discussion in flux-framework#1094. Update users across flux-core, and unit tests.
Rename flux_rpc_getf() to flux_rpc_get_unpack() per discussion in flux-framework#1094. Update users across flux-core, and unit tests.
Rename flux_event_decodef() to flux_event_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, barrier module, and broker.
Rename flux_event_encodef() to flux_event_pack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, wreck job module, wrexecd, and broker.
Rename flux_request_decodef() to flux_request_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, broker, and various modules.
Rename flux_kvs_lookup_getf() to flux_kvs_lookup_get_unpack() per discussion in flux-framework#1094. Update users in flux-kvs, libjsc, resource-hwloc module, wrexecd, and KVS tests.
Rename flux_msg_set_jsonf() to flux_msg_pack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_msg_vset_jsonf() to flux_msg_vpack() per discussion in flux-framework#1094. Update users in libflux message encoding functions.
Rename flux_msg_get_jsonf() to flux_msg_unpack() per discussion in flux-framework#1094. Update unit tests.
Rename flux_msg_vget_jsonf() to flux_msg_vunpack() per discussion in flux-framework#1094. Update users in libflux message decoding functions.
Rename flux_rpcf() to flux_rpc_pack() per discussion in flux-framework#1094. Update users across flux-core, and unit tests.
Rename flux_rpc_getf() to flux_rpc_get_unpack() per discussion in flux-framework#1094. Update users across flux-core, and unit tests.
Rename flux_event_decodef() to flux_event_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, barrier module, and broker.
Rename flux_event_encodef() to flux_event_pack() per discussion in flux-framework#1094. Update unit tests and users in libflux, libjsc, wreck job module, wrexecd, and broker.
Rename flux_request_decodef() to flux_request_unpack() per discussion in flux-framework#1094. Update unit tests and users in libflux, broker, and various modules.
Rework the "write" side of the KVS API in terms of an explicit transaction object as discussed in flux-framework#1094. The interface is essentially - create txn - append ops to txn: put, pack, link, mkdir, unlink, symlink - commit/fence txn - destroy txn Also: rename the KVS_NOMERGE flag to FLUX_KVS_NOMERGE. Provide a private interface so that unit tests can examine internal contents of a commit.
Rework the "write" side of the KVS API in terms of an explicit transaction object as discussed in flux-framework#1094. The interface is essentially - create txn - append ops to txn: put, pack, link, mkdir, unlink, symlink - commit/fence txn - destroy txn Also: rename the KVS_NOMERGE flag to FLUX_KVS_NOMERGE. Provide a private interface so that unit tests can examine internal contents of a commit.
Rework the "write" side of the KVS API in terms of an explicit transaction object as discussed in flux-framework#1094. The interface is essentially - create txn - append ops to txn: put, pack, mkdir, unlink, symlink - commit/fence txn - destroy txn Also: rename the KVS_NOMERGE flag to FLUX_KVS_NOMERGE. Provide a private interface so that unit tests can examine internal contents of a commit.
Rework the "write" side of the KVS API in terms of an explicit transaction object as discussed in flux-framework#1094. The interface is essentially - create txn - append ops to txn: put, pack, mkdir, unlink, symlink - commit/fence txn - destroy txn Also: rename the KVS_NOMERGE flag to FLUX_KVS_NOMERGE. Provide a private interface so that unit tests can examine internal contents of a commit.
I think the basic changes proposed in this bug have been merged now. Not "convenience functions" yet but all the substantive discussion about lookup, txns, and varargs naming has been addressed, so closing. |
As started in #76, proposed new KVS interfaces
Transactions:
Commit/fence:
Convenience (put):
Get:
// FILL IN
Watch:
// FILL IN
The text was updated successfully, but these errors were encountered: