Skip to content

Commit

Permalink
mxq_daemon: Publish daemon prerequisites to database
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Mar 29, 2021
1 parent 053bd55 commit 0dc49a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mxq_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "mxq_daemon.h"

#define DAEMON_FIELDS_CNT 18
#define DAEMON_FIELDS_CNT 19
#define DAEMON_FIELDS \
" daemon_id," \
" daemon_name," \
Expand All @@ -36,7 +36,8 @@
" UNIX_TIMESTAMP(daemon_start) as daemon_start," \
" UNIX_TIMESTAMP(daemon_stop) as daemon_stop," \
" daemon_flags," \
" tags"
" tags," \
" prerequisites"

#undef _to_string
#undef status_str
Expand Down Expand Up @@ -79,6 +80,7 @@ static int bind_result_daemon_fields(struct mx_mysql_bind *result, struct mxq_da

res += mx_mysql_bind_var(result, idx++, int32, &(daemon->daemon_flags));
res += mx_mysql_bind_var(result, idx++, string, &(daemon->tags));
res += mx_mysql_bind_var(result, idx++, string, &(daemon->prerequisites));

return res;
}
Expand Down Expand Up @@ -143,7 +145,8 @@ int mxq_daemon_register(struct mx_mysql *mysql, struct mxq_daemon *daemon)
" daemon_start = CURRENT_TIMESTAMP(),"
" daemon_stop = 0,"
" daemon_flags = ?,"
" tags = ?"
" tags = ?,"
" prerequisites = ?"
);
if (!stmt) {
mx_log_err("mx_mysql_statement_prepare(): %m");
Expand All @@ -170,6 +173,7 @@ int mxq_daemon_register(struct mx_mysql *mysql, struct mxq_daemon *daemon)
res += mx_mysql_statement_param_bind(stmt, idx++, uint64, &(daemon->daemon_memory_limit_slot_hard));
res += mx_mysql_statement_param_bind(stmt, idx++, int32, &(daemon->daemon_flags));
res += mx_mysql_statement_param_bind(stmt, idx++, string, &(daemon->tags));
res += mx_mysql_statement_param_bind(stmt, idx++, string, &(daemon->prerequisites));

assert(res ==0);

Expand Down

0 comments on commit 0dc49a7

Please sign in to comment.