🦄 refactor(stellar api): split exdata and mq
This commit is contained in:
52
include/stellar/mq.h
Normal file
52
include/stellar/mq.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct mq_schema;
|
||||
struct mq_schema *mq_schema_new();
|
||||
void mq_schema_free(struct mq_schema *s);
|
||||
|
||||
struct mq_runtime;
|
||||
struct mq_runtime *mq_runtime_new(struct mq_schema *s);
|
||||
void mq_runtime_free(struct mq_runtime *s);
|
||||
|
||||
typedef void mq_msg_free_cb_func(void *msg, void *msg_free_arg);
|
||||
typedef void on_msg_cb_func(int topic_id, const void *msg, void *on_msg_arg);
|
||||
typedef void on_msg_dispatch_cb_func(int topic_id,
|
||||
const void *msg,
|
||||
on_msg_cb_func* on_msg_cb,
|
||||
void *on_msg_cb_arg,
|
||||
void *dispatch_arg);
|
||||
|
||||
//return topic_id
|
||||
int mq_schema_create_topic(struct mq_schema *s,
|
||||
const char *topic_name,
|
||||
on_msg_dispatch_cb_func *on_dispatch_cb,
|
||||
void *on_dispatch_arg,
|
||||
mq_msg_free_cb_func *msg_free_cb,
|
||||
void *msg_free_arg);
|
||||
|
||||
int mq_schema_get_topic_id(struct mq_schema *s, const char *topic_name);
|
||||
|
||||
int mq_schema_update_topic(struct mq_schema *s,
|
||||
int topic_id,
|
||||
on_msg_dispatch_cb_func *on_dispatch_cb,
|
||||
void *on_dispatch_arg,
|
||||
mq_msg_free_cb_func *msg_free_cb,
|
||||
void *msg_free_arg);
|
||||
|
||||
int mq_schema_destroy_topic(struct mq_schema *s, int topic_id);
|
||||
|
||||
//return 0 if success, otherwise return -1.
|
||||
int mq_schema_subscribe(struct mq_schema *s, int topic_id, on_msg_cb_func *on_msg_cb, void * on_msg_cb_arg);
|
||||
|
||||
|
||||
int mq_runtime_publish_message(struct mq_runtime *rt, int topic_id, void *msg);
|
||||
void mq_runtime_dispatch(struct mq_runtime *rt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user