From 5128caf8acad1c6a4f308389e6866dfc80db7dbc Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 2 Aug 2014 20:13:49 +0200 Subject: [PATCH] frontend: Renamed sdb_fe_ functions to sdb_fe_exec_. That name better describes what the function is doing. --- src/frontend/connection.c | 6 +++--- src/frontend/query.c | 19 ++++++++++--------- src/include/frontend/connection.h | 31 ++++++++++++++++--------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/frontend/connection.c b/src/frontend/connection.c index 0bdafdc..2fdc5e9 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -326,11 +326,11 @@ command_handle(sdb_conn_t *conn) char hostname[conn->cmd_len + 1]; strncpy(hostname, sdb_strbuf_string(conn->buf), conn->cmd_len); hostname[sizeof(hostname) - 1] = '\0'; - status = sdb_fe_fetch(conn, hostname, /* filter = */ NULL); + status = sdb_fe_exec_fetch(conn, hostname, /* filter = */ NULL); break; } case CONNECTION_LIST: - status = sdb_fe_list(conn, /* filter = */ NULL); + status = sdb_fe_exec_list(conn, /* filter = */ NULL); break; case CONNECTION_LOOKUP: { @@ -348,7 +348,7 @@ command_handle(sdb_conn_t *conn) break; } - status = sdb_fe_lookup(conn, m, /* filter = */ NULL); + status = sdb_fe_exec_lookup(conn, m, /* filter = */ NULL); sdb_object_deref(SDB_OBJ(m)); break; } diff --git a/src/frontend/query.c b/src/frontend/query.c index 6fa2a61..fda93f6 100644 --- a/src/frontend/query.c +++ b/src/frontend/query.c @@ -74,10 +74,10 @@ sdb_fe_exec(sdb_conn_t *conn, sdb_conn_node_t *node) switch (node->cmd) { case CONNECTION_FETCH: - return sdb_fe_fetch(conn, CONN_FETCH(node)->name, + return sdb_fe_exec_fetch(conn, CONN_FETCH(node)->name, /* filter = */ NULL); case CONNECTION_LIST: - return sdb_fe_list(conn, /* filter = */ NULL); + return sdb_fe_exec_list(conn, /* filter = */ NULL); case CONNECTION_LOOKUP: { sdb_store_matcher_t *m = NULL, *filter = NULL; @@ -85,7 +85,7 @@ sdb_fe_exec(sdb_conn_t *conn, sdb_conn_node_t *node) m = CONN_LOOKUP(node)->matcher->matcher; if (CONN_LOOKUP(node)->filter) filter = CONN_LOOKUP(node)->filter->matcher; - return sdb_fe_lookup(conn, m, filter); + return sdb_fe_exec_lookup(conn, m, filter); } default: @@ -96,7 +96,8 @@ sdb_fe_exec(sdb_conn_t *conn, sdb_conn_node_t *node) } /* sdb_fe_exec */ int -sdb_fe_fetch(sdb_conn_t *conn, const char *name, sdb_store_matcher_t *filter) +sdb_fe_exec_fetch(sdb_conn_t *conn, const char *name, + sdb_store_matcher_t *filter) { sdb_strbuf_t *buf; sdb_store_obj_t *host; @@ -137,10 +138,10 @@ sdb_fe_fetch(sdb_conn_t *conn, const char *name, sdb_store_matcher_t *filter) sdb_strbuf_destroy(buf); sdb_object_deref(SDB_OBJ(host)); return 0; -} /* sdb_fe_fetch */ +} /* sdb_fe_exec_fetch */ int -sdb_fe_list(sdb_conn_t *conn, sdb_store_matcher_t *filter) +sdb_fe_exec_list(sdb_conn_t *conn, sdb_store_matcher_t *filter) { sdb_strbuf_t *buf; @@ -168,10 +169,10 @@ sdb_fe_list(sdb_conn_t *conn, sdb_store_matcher_t *filter) (uint32_t)sdb_strbuf_len(buf), sdb_strbuf_string(buf)); sdb_strbuf_destroy(buf); return 0; -} /* sdb_fe_list */ +} /* sdb_fe_exec_list */ int -sdb_fe_lookup(sdb_conn_t *conn, sdb_store_matcher_t *m, +sdb_fe_exec_lookup(sdb_conn_t *conn, sdb_store_matcher_t *m, sdb_store_matcher_t *filter) { tojson_data_t data = { NULL, filter, 0 }; @@ -207,7 +208,7 @@ sdb_fe_lookup(sdb_conn_t *conn, sdb_store_matcher_t *m, (uint32_t)sdb_strbuf_len(data.buf), sdb_strbuf_string(data.buf)); sdb_strbuf_destroy(data.buf); return 0; -} /* sdb_fe_lookup */ +} /* sdb_fe_exec_lookup */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */ diff --git a/src/include/frontend/connection.h b/src/include/frontend/connection.h index 30e6509..bff3f3b 100644 --- a/src/include/frontend/connection.h +++ b/src/include/frontend/connection.h @@ -166,43 +166,44 @@ sdb_fe_session_start(sdb_conn_t *conn); */ /* - * sdb_fe_fetch: - * Send the named host, serialized as JSON, to the client. If specified, only - * objects matching the filter will be included. See sdb_store_tojson for - * details. + * sdb_fe_exec_fetch: + * Execute the 'FETCH' command. Send the named host, serialized as JSON, to + * the client. If specified, only objects matching the filter will be + * included. See sdb_store_tojson for details. * * Returns: * - 0 on success * - a negative value else */ int -sdb_fe_fetch(sdb_conn_t *conn, const char *name, sdb_store_matcher_t *filter); +sdb_fe_exec_fetch(sdb_conn_t *conn, const char *name, + sdb_store_matcher_t *filter); /* - * sdb_fe_list: - * Send a complete listing of the store, serialized as JSON, to the client. If - * specified, only objects matching the filter will be included. See - * sdb_store_tojson for details. + * sdb_fe_exec_list: + * Execute the 'LIST' command. Send a complete listing of the store, + * serialized as JSON, to the client. If specified, only objects matching the + * filter will be included. See sdb_store_tojson for details. * * Returns: * - 0 on success * - a negative value else */ int -sdb_fe_list(sdb_conn_t *conn, sdb_store_matcher_t *filter); +sdb_fe_exec_list(sdb_conn_t *conn, sdb_store_matcher_t *filter); /* - * sdb_fe_lookup: - * Send a list of hosts matching 'm', serialized as JSON, to the client. If - * specified, only objects matching the filter will be included. See - * sdb_store_tojson for details. + * sdb_fe_exec_lookup: + * Execute the 'LOOKUP' command. Send a list of hosts matching 'm', serialized + * as JSON, to the client. If specified, only objects matching the filter will + * be included. See sdb_store_tojson for details. * * Returns: * - 0 on success * - a negative value else */ int -sdb_fe_lookup(sdb_conn_t *conn, sdb_store_matcher_t *m, +sdb_fe_exec_lookup(sdb_conn_t *conn, sdb_store_matcher_t *m, sdb_store_matcher_t *filter); #ifdef __cplusplus -- 2.30.2