Skip to content

Commit

Permalink
libflux/rpc: rename rpcf->rpc_pack
Browse files Browse the repository at this point in the history
Rename flux_rpcf() to flux_rpc_pack() per discussion
in flux-framework#1094.

Update users across flux-core, and unit tests.
  • Loading branch information
garlick committed Jul 13, 2017
1 parent d56efae commit 9a5c28b
Show file tree
Hide file tree
Showing 23 changed files with 101 additions and 101 deletions.
4 changes: 2 additions & 2 deletions doc/man3/trpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ int main (int argc, char **argv)
if (!(h = flux_open (NULL, 0)))
log_err_exit ("flux_open");

if (!(f = flux_rpcf (h, "attr.get", FLUX_NODEID_ANY, 0,
"{s:s}", "name", "rank")))
if (!(f = flux_rpc_pack (h, "attr.get", FLUX_NODEID_ANY, 0,
"{s:s}", "name", "rank")))
log_err_exit ("flux_rpcf");

if (flux_rpc_getf (f, "{s:s}", "value", &rankstr) < 0)
Expand Down
6 changes: 3 additions & 3 deletions doc/man3/trpc_then.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ int main (int argc, char **argv)
if (!(h = flux_open (NULL, 0)))
log_err_exit ("flux_open");

if (!(f = flux_rpcf (h, "attr.get", FLUX_NODEID_ANY, 0,
"{s:s}", "name", "rank")))
log_err_exit ("flux_rpcf");
if (!(f = flux_rpc_pack (h, "attr.get", FLUX_NODEID_ANY, 0,
"{s:s}", "name", "rank")))
log_err_exit ("flux_rpc_pack");

if (flux_future_then (f, -1., continuation, NULL) < 0)
log_err_exit ("flux_future_then");
Expand Down
10 changes: 5 additions & 5 deletions src/broker/hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ static void r_forward (flux_reduce_t *r, int batch, void *arg)
assert (batch == 0);
assert (count > 0);

if (!(f = flux_rpcf (hello->h, "hello.join", FLUX_NODEID_UPSTREAM,
FLUX_RPC_NORESPONSE, "{ s:i s:i }",
"count", count,
"batch", batch)))
log_err_exit ("hello: flux_rpcf");
if (!(f = flux_rpc_pack (hello->h, "hello.join", FLUX_NODEID_UPSTREAM,
FLUX_RPC_NORESPONSE, "{ s:i s:i }",
"count", count,
"batch", batch)))
log_err_exit ("hello: flux_rpc_pack");
flux_future_destroy (f);
}

Expand Down
8 changes: 4 additions & 4 deletions src/cmd/builtin/heaptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ static int internal_heaptrace_start (optparse_t *p, int ac, char *av[])
}
if (!(h = builtin_get_flux_handle (p)))
log_err_exit ("flux_open");
if (!(f = flux_rpcf (h, "heaptrace.start", FLUX_NODEID_ANY, 0,
"{ s:s }", "filename", av[ac - 1]))
if (!(f = flux_rpc_pack (h, "heaptrace.start", FLUX_NODEID_ANY, 0,
"{ s:s }", "filename", av[ac - 1]))
|| flux_future_get (f, NULL) < 0)
log_err_exit ("heaptrace.start");
flux_future_destroy (f);
Expand Down Expand Up @@ -73,8 +73,8 @@ static int internal_heaptrace_dump (optparse_t *p, int ac, char *av[])
}
if (!(h = builtin_get_flux_handle (p)))
log_err_exit ("flux_open");
if (!(f = flux_rpcf (h, "heaptrace.dump", FLUX_NODEID_ANY, 0,
"{ s:s }", "reason", av[ac - 1]))
if (!(f = flux_rpc_pack (h, "heaptrace.dump", FLUX_NODEID_ANY, 0,
"{ s:s }", "reason", av[ac - 1]))
|| flux_rpc_get (f , NULL) < 0)
log_err_exit ("heaptrace.dump");
flux_future_destroy (f);
Expand Down
12 changes: 6 additions & 6 deletions src/cmd/builtin/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ static void delrole (flux_t *h, uint32_t userid, uint32_t rolemask)
uint32_t final;
char s[256];

f = flux_rpcf (h, "userdb.delrole", FLUX_NODEID_ANY, 0,
"{s:i s:i}", "userid", userid,
f = flux_rpc_pack (h, "userdb.delrole", FLUX_NODEID_ANY, 0,
"{s:i s:i}", "userid", userid,
"rolemask", rolemask);
if (!f)
log_err_exit ("userdb.delrole");
Expand All @@ -130,8 +130,8 @@ static void addrole (flux_t *h, uint32_t userid, uint32_t rolemask)
uint32_t final;
char s[256];

f = flux_rpcf (h, "userdb.addrole", FLUX_NODEID_ANY, 0,
"{s:i s:i}", "userid", userid,
f = flux_rpc_pack (h, "userdb.addrole", FLUX_NODEID_ANY, 0,
"{s:i s:i}", "userid", userid,
"rolemask", rolemask);
if (!f)
log_err_exit ("userdb.addrole");
Expand Down Expand Up @@ -230,8 +230,8 @@ static int internal_user_lookup (optparse_t *p, int ac, char *av[])
log_msg_exit ("%s: invalid userid", av[n]);
if (!(h = builtin_get_flux_handle (p)))
log_err_exit ("flux_open");
f = flux_rpcf (h, "userdb.lookup", FLUX_NODEID_ANY, 0,
"{s:i}", "userid", userid);
f = flux_rpc_pack (h, "userdb.lookup", FLUX_NODEID_ANY, 0,
"{s:i}", "userid", userid);
if (!f)
log_err_exit ("userdb.lookup");
if (flux_rpc_getf (f, "{s:i s:i}", "userid", &userid,
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/flux-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ int cmd_debug (optparse_t *p, int argc, char **argv)
op = "setbit";
flags = strtoul (optparse_get_str (p, "setbit", NULL), NULL, 0);
}
if (!(f = flux_rpcf (h, topic, FLUX_NODEID_ANY, 0, "{s:s s:i}",
"op", op, "flags", flags)))
if (!(f = flux_rpc_pack (h, topic, FLUX_NODEID_ANY, 0, "{s:s s:i}",
"op", op, "flags", flags)))
log_err_exit ("%s", topic);
if (flux_rpc_getf (f, "{s:i}", "flags", &flags) < 0)
log_err_exit ("%s", topic);
Expand Down
14 changes: 7 additions & 7 deletions src/common/libflux/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ static int attr_get_rpc (attr_ctx_t *ctx, const char *name, attr_t **attrp)
attr_t *attr;
int rc = -1;

if (!(f = flux_rpcf (ctx->h, "attr.get", FLUX_NODEID_ANY, 0,
"{s:s}", "name", name)))
if (!(f = flux_rpc_pack (ctx->h, "attr.get", FLUX_NODEID_ANY, 0,
"{s:s}", "name", name)))
goto done;
if (flux_rpc_getf (f, "{s:s, s:i}", "value", &val, "flags", &flags) < 0)
goto done;
Expand All @@ -125,12 +125,12 @@ static int attr_set_rpc (attr_ctx_t *ctx, const char *name, const char *val)

#if JANSSON_VERSION_HEX >= 0x020800
/* $? format specifier was introduced in jansson 2.8 */
f = flux_rpcf (ctx->h, "attr.set", FLUX_NODEID_ANY, 0,
"{s:s, s:s?}", "name", name, "value", val);
f = flux_rpc_pack (ctx->h, "attr.set", FLUX_NODEID_ANY, 0,
"{s:s, s:s?}", "name", name, "value", val);
#else
f = flux_rpcf (ctx->h, "attr.set", FLUX_NODEID_ANY, 0,
val ? "{s:s, s:s}" : "{s:s, s:n}",
"name", name, "value", val);
f = flux_rpc_pack (ctx->h, "attr.set", FLUX_NODEID_ANY, 0,
val ? "{s:s, s:s}" : "{s:s, s:n}",
"name", name, "value", val);
#endif
if (!f)
goto done;
Expand Down
4 changes: 2 additions & 2 deletions src/common/libflux/barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ flux_future_t *flux_barrier (flux_t *h, const char *name, int nprocs)
if (!name && !(name = generate_unique_name (h)))
return NULL;

return flux_rpcf (h, "barrier.enter", FLUX_NODEID_ANY, 0,
"{s:s s:i s:i s:b}",
return flux_rpc_pack (h, "barrier.enter", FLUX_NODEID_ANY, 0,
"{s:s s:i s:i s:b}",
"name", name,
"count", 1,
"nprocs", nprocs,
Expand Down
8 changes: 4 additions & 4 deletions src/common/libflux/flog.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ static int dmesg_clear (flux_t *h, int seq)
flux_future_t *f;
int rc = -1;

if (!(f = flux_rpcf (h, "log.clear", FLUX_NODEID_ANY, 0,
"{s:i}", "seq", seq)))
if (!(f = flux_rpc_pack (h, "log.clear", FLUX_NODEID_ANY, 0,
"{s:i}", "seq", seq)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand All @@ -229,8 +229,8 @@ static int dmesg_clear (flux_t *h, int seq)

static flux_future_t *dmesg_rpc (flux_t *h, int seq, bool follow)
{
return flux_rpcf (h, "log.dmesg", FLUX_NODEID_ANY, 0,
"{s:i s:b}", "seq", seq, "follow", follow);
return flux_rpc_pack (h, "log.dmesg", FLUX_NODEID_ANY, 0,
"{s:i s:b}", "seq", seq, "follow", follow);
}

static int dmesg_rpc_get (flux_future_t *f, int *seq, flux_log_f fun, void *arg)
Expand Down
4 changes: 2 additions & 2 deletions src/common/libflux/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ int flux_panic (flux_t *h, int rank, const char *msg)
flux_future_t *f = NULL;
int rc = -1;

f = flux_rpcf (h, "cmb.panic", nodeid, FLUX_RPC_NORESPONSE,
"{s:s}", "msg", msg ? msg : "");
f = flux_rpc_pack (h, "cmb.panic", nodeid, FLUX_RPC_NORESPONSE,
"{s:s}", "msg", msg ? msg : "");
if (!f)
goto done;
/* No reply */
Expand Down
16 changes: 8 additions & 8 deletions src/common/libflux/rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ flux_future_t *flux_rpc_raw (flux_t *h,
return f;
}

static flux_future_t *flux_vrpcf (flux_t *h,
const char *topic,
uint32_t nodeid,
int flags,
const char *fmt, va_list ap)
static flux_future_t *flux_rpc_vpack (flux_t *h,
const char *topic,
uint32_t nodeid,
int flags,
const char *fmt, va_list ap)
{
flux_msg_t *msg;
flux_future_t *f = NULL;
Expand All @@ -303,14 +303,14 @@ static flux_future_t *flux_vrpcf (flux_t *h,
return f;
}

flux_future_t *flux_rpcf (flux_t *h, const char *topic, uint32_t nodeid,
int flags, const char *fmt, ...)
flux_future_t *flux_rpc_pack (flux_t *h, const char *topic, uint32_t nodeid,
int flags, const char *fmt, ...)
{
va_list ap;
flux_future_t *f;

va_start (ap, fmt);
f = flux_vrpcf (h, topic, nodeid, flags, fmt, ap);
f = flux_rpc_vpack (h, topic, nodeid, flags, fmt, ap);
va_end (ap);
return f;
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/libflux/rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ enum {
flux_future_t *flux_rpc (flux_t *h, const char *topic, const char *json_str,
uint32_t nodeid, int flags);

flux_future_t *flux_rpcf (flux_t *h, const char *topic, uint32_t nodeid,
int flags, const char *fmt, ...);
flux_future_t *flux_rpc_pack (flux_t *h, const char *topic, uint32_t nodeid,
int flags, const char *fmt, ...);

flux_future_t *flux_rpc_raw (flux_t *h, const char *topic,
const void *data, int len,
Expand Down
4 changes: 2 additions & 2 deletions src/common/libkvs/kvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ int kvs_wait_version (flux_t *h, int version)
flux_future_t *f;
int ret = -1;

if (!(f = flux_rpcf (h, "kvs.sync", FLUX_NODEID_ANY, 0, "{ s:i }",
"rootseq", version)))
if (!(f = flux_rpc_pack (h, "kvs.sync", FLUX_NODEID_ANY, 0, "{ s:i }",
"rootseq", version)))
goto done;
/* N.B. response contains (rootseq, rootdir) but we don't need it.
*/
Expand Down
14 changes: 7 additions & 7 deletions src/common/libkvs/kvs_lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

flux_future_t *flux_kvs_lookup (flux_t *h, int flags, const char *key)
{
return flux_rpcf (h, "kvs.get", FLUX_NODEID_ANY, 0, "{s:s s:i}",
"key", key,
"flags", flags);
return flux_rpc_pack (h, "kvs.get", FLUX_NODEID_ANY, 0, "{s:s s:i}",
"key", key,
"flags", flags);
}

flux_future_t *flux_kvs_lookupat (flux_t *h, int flags, const char *key,
Expand All @@ -55,10 +55,10 @@ flux_future_t *flux_kvs_lookupat (flux_t *h, int flags, const char *key,
errno = EINVAL;
return NULL;
}
f = flux_rpcf (h, "kvs.get", FLUX_NODEID_ANY, 0, "{s:s s:i s:O}",
"key", key,
"flags", flags,
"rootdir", obj);
f = flux_rpc_pack (h, "kvs.get", FLUX_NODEID_ANY, 0, "{s:s s:i s:O}",
"key", key,
"flags", flags,
"rootdir", obj);
}
json_decref (obj);
return f;
Expand Down
4 changes: 2 additions & 2 deletions src/connectors/local/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ static int op_event (void *impl, const char *topic, const char *msg_topic)

assert (c->magic == CTX_MAGIC);

if (!(f = flux_rpcf (c->h, msg_topic, FLUX_NODEID_ANY, 0,
"{s:s}", "topic", topic)))
if (!(f = flux_rpc_pack (c->h, msg_topic, FLUX_NODEID_ANY, 0,
"{s:s}", "topic", topic)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand Down
8 changes: 4 additions & 4 deletions src/connectors/shmem/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ static int op_event_subscribe (void *impl, const char *topic)
flux_future_t *f;
int rc = -1;

if (!(f = flux_rpcf (ctx->h, "cmb.sub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
if (!(f = flux_rpc_pack (ctx->h, "cmb.sub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand All @@ -157,8 +157,8 @@ static int op_event_unsubscribe (void *impl, const char *topic)
flux_future_t *f = NULL;
int rc = -1;

if (!(f = flux_rpcf (ctx->h, "cmb.unsub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
if (!(f = flux_rpc_pack (ctx->h, "cmb.unsub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand Down
8 changes: 4 additions & 4 deletions src/connectors/ssh/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ static int op_event_subscribe (void *impl, const char *topic)
flux_future_t *f;
int rc = 0;

if (!(f = flux_rpcf (c->h, "local.sub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
if (!(f = flux_rpc_pack (c->h, "local.sub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand All @@ -156,8 +156,8 @@ static int op_event_unsubscribe (void *impl, const char *topic)
flux_future_t *f;
int rc = 0;

if (!(f = flux_rpcf (c->h, "local.unsub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
if (!(f = flux_rpc_pack (c->h, "local.unsub", FLUX_NODEID_ANY, 0,
"{ s:s }", "topic", topic)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand Down
12 changes: 6 additions & 6 deletions src/modules/barrier/barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ static void send_enter_request (barrier_ctx_t *ctx, barrier_t *b)
{
flux_future_t *f;

if (!(f = flux_rpcf (ctx->h, "barrier.enter", FLUX_NODEID_UPSTREAM,
FLUX_RPC_NORESPONSE, "{s:s s:i s:i s:b}",
"name", b->name,
"count", b->count,
"nprocs", b->nprocs,
"internal", true))) {
if (!(f = flux_rpc_pack (ctx->h, "barrier.enter", FLUX_NODEID_UPSTREAM,
FLUX_RPC_NORESPONSE, "{s:s s:i s:i s:b}",
"name", b->name,
"count", b->count,
"nprocs", b->nprocs,
"internal", true))) {
flux_log_error (ctx->h, "sending barrier.enter request");
goto done;
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/connector-local/local.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ static int lookup_userdb (flux_t *h, uint32_t userid, uint32_t *rolemask)
flux_future_t *f;
int rc = -1;

if (!(f = flux_rpcf (h, "userdb.lookup", FLUX_NODEID_ANY, 0,
"{s:i}", "userid", userid)))
if (!(f = flux_rpc_pack (h, "userdb.lookup", FLUX_NODEID_ANY, 0,
"{s:i}", "userid", userid)))
goto done;
if (flux_rpc_getf (f, "{s:i}", "rolemask", rolemask) < 0)
goto done;
Expand Down
8 changes: 4 additions & 4 deletions src/modules/content-sqlite/content-sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ int register_backing_store (flux_t *h, bool value, const char *name)
int saved_errno = 0;
int rc = -1;

if (!(f = flux_rpcf (h, "content.backing", FLUX_NODEID_ANY, 0,
"{ s:b s:s }",
"backing", value,
"name", name)))
if (!(f = flux_rpc_pack (h, "content.backing", FLUX_NODEID_ANY, 0,
"{ s:b s:s }",
"backing", value,
"name", name)))
goto done;
if (flux_future_get (f, NULL) < 0)
goto done;
Expand Down
14 changes: 7 additions & 7 deletions src/modules/cron/cron.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ static int64_t next_cronid (flux_t *h)
int64_t ret = (int64_t) -1;
flux_future_t *f;

if (!(f = flux_rpcf (h, "seq.fetch", 0, 0,
"{ s:s s:i s:i s:b }",
"name", "cron",
"preincrement", 1,
"postincrement", 0,
"create", true))) {
flux_log_error (h, "flux_rpcf");
if (!(f = flux_rpc_pack (h, "seq.fetch", 0, 0,
"{ s:s s:i s:i s:b }",
"name", "cron",
"preincrement", 1,
"postincrement", 0,
"create", true))) {
flux_log_error (h, "flux_rpc_pack");
goto out;
}

Expand Down
Loading

0 comments on commit 9a5c28b

Please sign in to comment.