mirror of
https://github.com/logos-messaging/negentropy.git
synced 2026-01-02 14:03:07 +00:00
chore: reverting callback changes
This commit is contained in:
parent
34fd921b89
commit
97b7ef1156
@ -42,23 +42,19 @@ void* negentropy_new(void* storage, uint64_t frameSizeLimit){
|
||||
return ne;
|
||||
}
|
||||
|
||||
void negentropy_initiate(void* negentropy, void (*callback)(const char* buf, size_t len)){
|
||||
const char* negentropy_initiate(void* negentropy){
|
||||
Negentropy<negentropy::storage::BTreeMem>* ngn_inst;
|
||||
ngn_inst = reinterpret_cast<Negentropy<negentropy::storage::BTreeMem>*>(negentropy);
|
||||
|
||||
std::string output;
|
||||
std::string* output = new std::string();
|
||||
try {
|
||||
output = ngn_inst->initiate();
|
||||
std::cout << "output of initiate is, len:" << output.size() << std::hex << output << std::endl;
|
||||
*output = ngn_inst->initiate();
|
||||
std::cout << "output of initiate is, len:" << output->size() << std::hex << *output << std::endl;
|
||||
} catch(negentropy::err e){
|
||||
//TODO:Find a way to return this error
|
||||
callback(NULL,0);
|
||||
return ;
|
||||
return NULL;
|
||||
}
|
||||
callback(output.c_str(), output.size());
|
||||
//TODO: Avoid copy and use a callback
|
||||
//memcpy(buf, output, output.size())
|
||||
return ;
|
||||
return output->c_str();
|
||||
}
|
||||
|
||||
void negentropy_setinitiator(void* negentropy){
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _NEGENTROPY_WRAPPER_H
|
||||
#define _NEGENTROPY_WRAPPER_H
|
||||
|
||||
@ -19,7 +20,7 @@ EXTERNC void* storage_new(const char* db_path, const char* name);
|
||||
|
||||
EXTERNC void* negentropy_new(void* storage, uint64_t frameSizeLimit);
|
||||
|
||||
EXTERNC void negentropy_initiate(void* negentropy, void *(const char* buf, size_t len));
|
||||
EXTERNC const char* negentropy_initiate(void* negentropy);
|
||||
|
||||
EXTERNC void negentropy_setinitiator(void* negentropy);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user