negentropy/cpp/negentropy_wrapper.h

32 lines
977 B
C
Raw Normal View History

2024-02-16 09:45:59 +00:00
#ifndef _NEGENTROPY_WRAPPER_H
#define _NEGENTROPY_WRAPPER_H
2024-02-16 09:45:59 +00:00
#include "negentropy.h"
#include "negentropy/storage/BTreeLMDB.h"
2024-02-16 12:04:49 +00:00
#define length(array) ((sizeof(array)) / (sizeof(array[0])))
2024-02-16 09:45:59 +00:00
//This is a C-wrapper for the C++ library that helps in integrating negentropy with nim code.
//TODO: Do error handling by catching exceptions
void* storage_new(const char* db_path, const char* name);
2024-02-16 09:45:59 +00:00
void* negentropy_new(void* storage, uint64_t frameSizeLimit);
2024-02-16 09:45:59 +00:00
const char* negentropy_initiate(void* negentropy);
2024-02-16 09:45:59 +00:00
void negentropy_setinitiator(void* negentropy);
2024-02-16 09:45:59 +00:00
bool storage_insert(void* storage, uint64_t createdAt, const char* id);
2024-02-16 09:45:59 +00:00
bool storage_erase(void* storage, uint64_t createdAt, const char* id);
2024-02-16 12:04:49 +00:00
const char* reconcile(void* negentropy, const char* query);
2024-02-16 12:04:49 +00:00
const char* reconcile_with_ids(void* negentropy, const char* query, const char* have_ids[],
uint64_t have_ids_len, const char* need_ids[], uint64_t need_ids_len);
2024-02-16 12:04:49 +00:00
#endif
2024-02-16 12:04:49 +00:00