Code

frontend: Connection-specific functions now use the sdb_conn_ prefix.
authorSebastian Harl <sh@tokkee.org>
Thu, 13 Aug 2015 16:55:34 +0000 (18:55 +0200)
committerSebastian Harl <sh@tokkee.org>
Thu, 13 Aug 2015 16:55:34 +0000 (18:55 +0200)
… instead of sdb_fe_.

src/frontend/connection.c
src/frontend/query.c
src/frontend/session.c
src/include/frontend/connection.h
t/unit/frontend/query_test.c

index ebc3b99332d92d0e929f51467edbc549f0088630..807bd074aa295108a5445cc6d3d82d760a996df2 100644 (file)
@@ -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);
index 9315582292fa181b19e2f663a1591ff5fddda592..724144aafb91a63369efb98cd0c97a55b5a7f8a9 100644 (file)
@@ -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 : */
 
index ed68c61cc747e89dbbadba928a29536cca702bb5..f64a1b967cb541bd0ba4241e426f380b14153b1c 100644 (file)
@@ -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 : */
 
index ad90da3b48a3edb0aa28dfde3dfa85aa8b6483fd..349993224ebfe336ad7033d312274ee60ff9b99c 100644 (file)
@@ -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" */
index 5330999c2d091e9828b00dc9d0c01fb1509b810a..e36c302422089adbe740b9ecd2cdd5710bcda03a 100644 (file)
@@ -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);