feature: adding Kafka infrastructure

This commit is contained in:
luwenpeng
2024-07-17 15:47:07 +08:00
parent b59b736e4d
commit cc5a537940
14 changed files with 336 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <MESA/field_stat2.h>
#include <MESA/MESA_prof_load.h>
#include "log.h"

View File

@@ -3,6 +3,7 @@
#include "sce.h"
#include "log.h"
#include "kafka.h"
#include "global_metrics.h"
char *memdup(const char *src, int len)
@@ -87,6 +88,12 @@ struct sce_ctx *sce_ctx_create(const char *profile)
CPU_SET(cpu_id, &sce_ctx->coremask);
}
sce_ctx->kfk = kafka_create(profile);
if (sce_ctx->kfk == NULL)
{
goto error_out;
}
sce_ctx->ts = timestamp_new(sce_ctx->ts_update_interval_ms);
sce_ctx->metrics = global_metrics_create(profile, sce_ctx->nr_worker_threads);
if (sce_ctx->metrics == NULL)
@@ -126,6 +133,7 @@ void sce_ctx_destory(struct sce_ctx *sce_ctx)
policy_enforcer_destory(sce_ctx->enforcer);
global_metrics_destory(sce_ctx->metrics);
timestamp_free(sce_ctx->ts);
kafka_destroy(sce_ctx->kfk);
free(sce_ctx);
sce_ctx = NULL;