// Generated manually and inspired by the one generated by the Nim Compiler. // In order to see the header file generated by Nim just run `make libsds` // from the root repo folder and the header should be created in // nimcache/release/libsds/libsds.h #ifndef __libsds__ #define __libsds__ #include #include // The possible returned values for the functions that return int #define RET_OK 0 #define RET_ERR 1 #define RET_MISSING_CALLBACK 2 #ifdef __cplusplus extern "C" { #endif typedef void (*SdsCallBack) (int callerRet, const char* msg, size_t len, void* userData); typedef void (*SdsRetrievalHintProvider) (const char* messageId, char** hint, size_t* hintLen, void* userData); // --- Core API Functions --- void* SdsNewReliabilityManager(SdsCallBack callback, void* userData); // Construct a Reliability Manager with an explicit participant ID and a // JSON-encoded ReliabilityConfig. // // participantId: stable, non-empty identifier for SDS-R. Pass NULL or "" to // disable SDS-R (the manager will not request or answer // repairs). It MUST be set-once at construction; do not change // it across the lifetime of the manager. // configJson: JSON object with optional fields for ReliabilityConfig. // Pass NULL or "" to use the full default config. Missing // fields fall back to per-field defaults. Duration fields use // the suffix "Ms" (integer milliseconds). // // Recognised JSON keys: // bloomFilterCapacity (int, default 10000) // bloomFilterErrorRate (float, default 0.001) // maxMessageHistory (int, default 1000) // maxCausalHistory (int, default 10) // resendIntervalMs (int, default 60000) // maxResendAttempts (int, default 5) // syncMessageIntervalMs (int, default 30000) // bufferSweepIntervalMs (int, default 60000) // repairTMinMs (int, default 30000) // repairTMaxMs (int, default 300000) // numResponseGroups (int, default 1) // maxRepairRequests (int, default 3) // repairSweepIntervalMs (int, default 5000) void* SdsNewReliabilityManagerWithConfig(const char* participantId, const char* configJson, SdsCallBack callback, void* userData); void SdsSetEventCallback(void* ctx, SdsCallBack callback, void* userData); void SdsSetRetrievalHintProvider(void* ctx, SdsRetrievalHintProvider callback, void* userData); int SdsCleanupReliabilityManager(void* ctx, SdsCallBack callback, void* userData); int SdsResetReliabilityManager(void* ctx, SdsCallBack callback, void* userData); int SdsWrapOutgoingMessage(void* ctx, void* message, size_t messageLen, const char* messageId, const char* channelId, SdsCallBack callback, void* userData); int SdsUnwrapReceivedMessage(void* ctx, void* message, size_t messageLen, SdsCallBack callback, void* userData); int SdsMarkDependenciesMet(void* ctx, char** messageIDs, size_t count, const char* channelId, SdsCallBack callback, void* userData); int SdsStartPeriodicTasks(void* ctx, SdsCallBack callback, void* userData); // Removes a channel and frees its per-channel state (buffers, bloom filter, // message cache, SDS-R repair entries). Safe to call on a channel that does // not exist; returns RET_OK in that case. int SdsRemoveChannel(void* ctx, const char* channelId, SdsCallBack callback, void* userData); #ifdef __cplusplus } #endif #endif /* __libsds__ */