From: Sebastian Harl Date: Thu, 13 Aug 2015 16:55:34 +0000 (+0200) Subject: frontend: Connection-specific functions now use the sdb_conn_ prefix. X-Git-Tag: sysdb-0.8.0~42 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ef3a4a955deddc45d5f381ce20653cac3ca51656;p=sysdb.git frontend: Connection-specific functions now use the sdb_conn_ prefix. … instead of sdb_fe_. --- diff --git a/src/frontend/connection.c b/src/frontend/connection.c index ebc3b99..807bd07 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -294,18 +294,18 @@ command_handle(sdb_conn_t *conn) if (conn->cmd == SDB_CONNECTION_PING) status = sdb_connection_ping(conn); else if (conn->cmd == SDB_CONNECTION_STARTUP) - status = sdb_fe_session_start(conn); + status = sdb_conn_session_start(conn); else if (conn->cmd == SDB_CONNECTION_QUERY) - status = sdb_fe_query(conn); + status = sdb_conn_query(conn); else if (conn->cmd == SDB_CONNECTION_FETCH) - status = sdb_fe_fetch(conn); + status = sdb_conn_fetch(conn); else if (conn->cmd == SDB_CONNECTION_LIST) - status = sdb_fe_list(conn); + status = sdb_conn_list(conn); else if (conn->cmd == SDB_CONNECTION_LOOKUP) - status = sdb_fe_lookup(conn); + status = sdb_conn_lookup(conn); else if (conn->cmd == SDB_CONNECTION_STORE) - status = sdb_fe_store(conn); + status = sdb_conn_store(conn); else if (conn->cmd == SDB_CONNECTION_SERVER_VERSION) status = sdb_connection_server_version(conn); diff --git a/src/frontend/query.c b/src/frontend/query.c index 9315582..724144a 100644 --- a/src/frontend/query.c +++ b/src/frontend/query.c @@ -88,7 +88,7 @@ query_exec(sdb_conn_t *conn, sdb_ast_node_t *ast) */ int -sdb_fe_query(sdb_conn_t *conn) +sdb_conn_query(sdb_conn_t *conn) { sdb_llist_t *parsetree; sdb_ast_node_t *ast = NULL; @@ -137,10 +137,10 @@ sdb_fe_query(sdb_conn_t *conn) } sdb_llist_destroy(parsetree); return status; -} /* sdb_fe_query */ +} /* sdb_conn_query */ int -sdb_fe_fetch(sdb_conn_t *conn) +sdb_conn_fetch(sdb_conn_t *conn) { sdb_ast_node_t *ast; char hostname[conn->cmd_len + 1]; @@ -174,10 +174,10 @@ sdb_fe_fetch(sdb_conn_t *conn) status = query_exec(conn, ast); sdb_object_deref(SDB_OBJ(ast)); return status; -} /* sdb_fe_fetch */ +} /* sdb_conn_fetch */ int -sdb_fe_list(sdb_conn_t *conn) +sdb_conn_list(sdb_conn_t *conn) { sdb_ast_node_t *ast; uint32_t type = SDB_HOST; @@ -200,10 +200,10 @@ sdb_fe_list(sdb_conn_t *conn) status = query_exec(conn, ast); sdb_object_deref(SDB_OBJ(ast)); return status; -} /* sdb_fe_list */ +} /* sdb_conn_list */ int -sdb_fe_lookup(sdb_conn_t *conn) +sdb_conn_lookup(sdb_conn_t *conn) { sdb_ast_node_t *ast, *m; const char *matcher; @@ -254,10 +254,10 @@ sdb_fe_lookup(sdb_conn_t *conn) sdb_object_deref(SDB_OBJ(m)); sdb_object_deref(SDB_OBJ(ast)); return status; -} /* sdb_fe_lookup */ +} /* sdb_conn_lookup */ int -sdb_fe_store(sdb_conn_t *conn) +sdb_conn_store(sdb_conn_t *conn) { sdb_ast_node_t *ast; const char *buf = sdb_strbuf_string(conn->buf); @@ -359,7 +359,7 @@ sdb_fe_store(sdb_conn_t *conn) status = query_exec(conn, ast); sdb_object_deref(SDB_OBJ(ast)); return status; -} /* sdb_fe_store */ +} /* sdb_conn_store */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */ diff --git a/src/frontend/session.c b/src/frontend/session.c index ed68c61..f64a1b9 100644 --- a/src/frontend/session.c +++ b/src/frontend/session.c @@ -40,7 +40,7 @@ */ int -sdb_fe_session_start(sdb_conn_t *conn) +sdb_conn_session_start(sdb_conn_t *conn) { char username[sdb_strbuf_len(conn->buf) + 1]; const char *tmp; @@ -70,7 +70,7 @@ sdb_fe_session_start(sdb_conn_t *conn) sdb_connection_send(conn, SDB_CONNECTION_OK, 0, NULL); conn->ready = 1; return 0; -} /* sdb_fe_session_start */ +} /* sdb_conn_session_start */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */ diff --git a/src/include/frontend/connection.h b/src/include/frontend/connection.h index ad90da3..3499932 100644 --- a/src/include/frontend/connection.h +++ b/src/include/frontend/connection.h @@ -151,7 +151,7 @@ sdb_connection_server_version(sdb_conn_t *conn); */ /* - * sdb_fe_session_start: + * sdb_conn_session_start: * Start a new user session on the specified connection. * * Returns: @@ -159,14 +159,15 @@ sdb_connection_server_version(sdb_conn_t *conn); * - a negative value else */ int -sdb_fe_session_start(sdb_conn_t *conn); +sdb_conn_session_start(sdb_conn_t *conn); /* * store access */ /* - * sdb_fe_query, sdb_fe_fetch, sdb_fe_list, sdb_fe_lookup, sdb_fe_store: + * sdb_conn_query, sdb_conn_fetch, sdb_conn_list, sdb_conn_lookup, + * sdb_conn_store: * Handle the SDB_CONNECTION_QUERY, SDB_CONNECTION_FETCH, SDB_CONNECTION_LIST, * SDB_CONNECTION_LOOKUP, and SDB_CONNECTION_STORE commands respectively. It * is expected that the current command has been initialized already. @@ -176,19 +177,19 @@ sdb_fe_session_start(sdb_conn_t *conn); * - a negative value else */ int -sdb_fe_query(sdb_conn_t *conn); +sdb_conn_query(sdb_conn_t *conn); int -sdb_fe_fetch(sdb_conn_t *conn); +sdb_conn_fetch(sdb_conn_t *conn); int -sdb_fe_list(sdb_conn_t *conn); +sdb_conn_list(sdb_conn_t *conn); int -sdb_fe_lookup(sdb_conn_t *conn); +sdb_conn_lookup(sdb_conn_t *conn); int -sdb_fe_store(sdb_conn_t *conn); +sdb_conn_store(sdb_conn_t *conn); /* - * sdb_fe_store_host, sdb_fe_store_service, sdb_fe_store_metric, - * sdb_fe_store_attribute: + * sdb_conn_store_host, sdb_conn_store_service, sdb_conn_store_metric, + * sdb_conn_store_attribute: * Execute the 'STORE' command for the respective object type. * * Returns: @@ -196,13 +197,13 @@ sdb_fe_store(sdb_conn_t *conn); * - a negative value else */ int -sdb_fe_store_host(sdb_conn_t *conn, const sdb_proto_host_t *host); +sdb_conn_store_host(sdb_conn_t *conn, const sdb_proto_host_t *host); int -sdb_fe_store_service(sdb_conn_t *conn, const sdb_proto_service_t *svc); +sdb_conn_store_service(sdb_conn_t *conn, const sdb_proto_service_t *svc); int -sdb_fe_store_metric(sdb_conn_t *conn, const sdb_proto_metric_t *metric); +sdb_conn_store_metric(sdb_conn_t *conn, const sdb_proto_metric_t *metric); int -sdb_fe_store_attribute(sdb_conn_t *conn, const sdb_proto_attribute_t *attr); +sdb_conn_store_attribute(sdb_conn_t *conn, const sdb_proto_attribute_t *attr); #ifdef __cplusplus } /* extern "C" */ diff --git a/t/unit/frontend/query_test.c b/t/unit/frontend/query_test.c index 5330999..e36c302 100644 --- a/t/unit/frontend/query_test.c +++ b/t/unit/frontend/query_test.c @@ -680,27 +680,27 @@ START_TEST(test_query) switch (conn->cmd) { case SDB_CONNECTION_QUERY: - check = sdb_fe_query(conn); + check = sdb_conn_query(conn); break; case SDB_CONNECTION_FETCH: - check = sdb_fe_fetch(conn); + check = sdb_conn_fetch(conn); break; case SDB_CONNECTION_LIST: - check = sdb_fe_list(conn); + check = sdb_conn_list(conn); break; case SDB_CONNECTION_LOOKUP: - check = sdb_fe_lookup(conn); + check = sdb_conn_lookup(conn); break; /* SDB_CONNECTION_TIMESERIES not supported yet */ case SDB_CONNECTION_STORE: - check = sdb_fe_store(conn); + check = sdb_conn_store(conn); break; default: fail("Invalid command %#x", conn->cmd); } fail_unless(check == query_data[_i].expected, - "sdb_fe_query(%s) = %d; expected: %d (err: %s)", + "sdb_conn_query(%s) = %d; expected: %d (err: %s)", query_data[_i].query, check, query_data[_i].expected, sdb_strbuf_string(conn->errbuf)); @@ -709,7 +709,7 @@ START_TEST(test_query) if (query_data[_i].code == UINT32_MAX) { fail_unless(len == 0, - "sdb_fe_query(%s) returned data on error: '%s'", + "sdb_conn_query(%s) returned data on error: '%s'", query_data[_i].query, data); mock_conn_destroy(conn); return; @@ -722,14 +722,14 @@ START_TEST(test_query) fail_unless((code == query_data[_i].code) && ((size_t)msg_len == query_data[_i].len), - "sdb_fe_query(%s) returned %u, %u; expected: %u, %zu", + "sdb_conn_query(%s) returned %u, %u; expected: %u, %zu", query_data[_i].query, code, msg_len, query_data[_i].code, query_data[_i].len); if (code == SDB_CONNECTION_DATA) { tmp = sdb_proto_unmarshal_int32(data, len, &code); fail_unless(code == query_data[_i].type, - "sdb_fe_query(%s) returned %s object; expected: %s", + "sdb_conn_query(%s) returned %s object; expected: %s", query_data[_i].query, SDB_CONN_MSGTYPE_TO_STRING((int)code), SDB_CONN_MSGTYPE_TO_STRING((int)query_data[_i].type)); data += tmp; @@ -737,7 +737,7 @@ START_TEST(test_query) } fail_if_strneq(data, query_data[_i].data, (size_t)msg_len, - "sdb_fe_query(%s) returned unexpected data", + "sdb_conn_query(%s) returned unexpected data", query_data[_i].query, data, query_data[_i].data); mock_conn_destroy(conn);