negentropy/cpp/negentropy_wrapper.h

37 lines
1.0 KiB
C
Raw Normal View History

#ifndef _NEGENTROPY_WRAPPER_H
#define _NEGENTROPY_WRAPPER_H
2024-02-16 15:15:59 +05:30
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
2024-02-16 17:34:49 +05:30
typedef struct _buffer_{
uint64_t len ;
char* data;
}buffer;
2024-02-16 15:15:59 +05:30
//This is a C-wrapper for the C++ library that helps in integrating negentropy with nim code.
//TODO: Do error handling by catching exceptions
EXTERNC void* storage_new(const char* db_path, const char* name);
2024-02-16 15:15:59 +05:30
EXTERNC void* negentropy_new(void* storage, uint64_t frameSizeLimit);
2024-02-16 15:15:59 +05:30
2024-02-22 15:19:27 +05:30
EXTERNC void negentropy_initiate(void* negentropy, void *(const char* buf, size_t len));
2024-02-16 15:15:59 +05:30
EXTERNC void negentropy_setinitiator(void* negentropy);
2024-02-16 15:15:59 +05:30
EXTERNC bool storage_insert(void* storage, uint64_t createdAt, buffer* id);
2024-02-16 15:15:59 +05:30
EXTERNC bool storage_erase(void* storage, uint64_t createdAt, buffer* id);
2024-02-16 17:34:49 +05:30
EXTERNC const char* reconcile(void* negentropy, buffer* query);
2024-02-16 17:34:49 +05:30
2024-02-22 15:19:27 +05:30
EXTERNC const char* reconcile_with_ids(void* negentropy, buffer* query, char* have_ids[],
uint64_t *have_ids_len, char* need_ids[], uint64_t *need_ids_len);
2024-02-16 17:34:49 +05:30
#endif
2024-02-16 17:34:49 +05:30