intégration des logiciels tier comme NanoMQ ainsi que les fichiers json de score

This commit is contained in:
2024-11-18 22:44:28 +01:00
parent 8f2ed89e05
commit a04c4c1f59
138 changed files with 27816 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#ifndef EXCHANGE_H
#define EXCHANGE_H
#include <stddef.h>
#include "core/nng_impl.h"
#include "nng/supplemental/nanolib/conf.h"
// Exchange MQ
#define EXCHANGE_NAME_LEN 32
#define TOPIC_NAME_LEN 128
#define RINGBUFFER_MAX 64
typedef struct exchange_s exchange_t;
struct exchange_s {
char name[EXCHANGE_NAME_LEN];
char topic[TOPIC_NAME_LEN];
ringBuffer_t *rbs[RINGBUFFER_MAX];
unsigned int rb_count;
};
NNG_DECL int exchange_client_get_msg_by_key(void *arg, uint64_t key, nni_msg **msg);
NNG_DECL int exchange_client_get_msgs_by_key(void *arg, uint64_t key, uint32_t count, nng_msg ***list);
NNG_DECL int exchange_client_get_msgs_fuzz(void *arg, uint64_t start, uint64_t end, uint32_t *count, nng_msg ***list);
NNG_DECL int exchange_init(exchange_t **ex, char *name, char *topic,
unsigned int *rbsCaps, char **rbsName, uint8_t *rbsFullOp, unsigned int rbsCount);
NNG_DECL int exchange_add_rb(exchange_t *ex, ringBuffer_t *rb);
NNG_DECL int exchange_release(exchange_t *ex);
NNG_DECL int exchange_handle_msg(exchange_t *ex, uint64_t key, void *msg, nng_aio *aio);
NNG_DECL int exchange_get_ringBuffer(exchange_t *ex, char *rbName, ringBuffer_t **rb);
#endif

View File

@ -0,0 +1,42 @@
//
// Copyright 2023 NanoMQ Team, Inc.
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt). A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//
#ifndef EXCHANGE_CLIENT_H
#define EXCHANGE_CLIENT_H
#ifdef __cplusplus
extern "C" {
#endif
#define nng_exchange_self 0
#define nng_exchange_self_name "exchange-client"
#define nng_exchange_peer 0
#define nng_exchange_peer_name "exchange-server"
#define nng_opt_exchange_add "exchange-client-add"
#define NNG_EXCHANGE_SELF 0
#define NNG_EXCHANGE_SELF_NAME "exchange-client"
#define NNG_EXCHANGE_PEER 0
#define NNG_EXCHANGE_PEER_NAME "exchange-server"
#define NNG_OPT_EXCHANGE_BIND "exchange-client-bind"
#define NNG_OPT_EXCHANGE_GET_EX_QUEUE "exchange-client-get-ex-queue"
#define NNG_OPT_EXCHANGE_GET_RBMSGMAP "exchange-client-get-rbmsgmap"
NNG_DECL int nng_exchange_client_open(nng_socket *sock);
#ifndef nng_exchange_open
#define nng_exchange_open nng_exchange_client_open
#endif
#ifdef __cplusplus
}
#endif
#endif // #define EXCHANGE_CLIENT_H

View File

@ -0,0 +1,23 @@
#ifndef PRODUCER_H
#define PRODUCER_H
#include<stddef.h>
typedef struct producer_s producer_t;
struct producer_s {
/*
* return: 0: success, -1: failed
*/
int (*match)(void *data);
/*
* return: 0: continue, -1: stop and return
*/
int (*target)(void *data);
};
int producer_init(producer_t **p,
int (*match)(void *data),
int (*target)(void *data));
int producer_release(producer_t *p);
#endif