mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-02 14:13:07 +00:00
fix: status-go compatibility issues (#9)
This commit is contained in:
parent
074eafe895
commit
61f7b6b8d5
13
Makefile
13
Makefile
@ -1,6 +1,8 @@
|
|||||||
.PHONY: libsds
|
.PHONY: libsds
|
||||||
|
|
||||||
export BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
export BUILD_SYSTEM_DIR := vendor/nimbus-build-system
|
||||||
|
LINK_PCRE := 0
|
||||||
|
|
||||||
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
||||||
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
||||||
|
|
||||||
@ -37,6 +39,17 @@ deps: | sds.nims
|
|||||||
# must be included after the default target
|
# must be included after the default target
|
||||||
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
||||||
|
|
||||||
|
## Git version
|
||||||
|
GIT_VERSION ?= $(shell git describe --abbrev=6 --always --tags)
|
||||||
|
## Compilation parameters. If defined in the CLI the assignments won't be executed
|
||||||
|
NIM_PARAMS := $(NIM_PARAMS) -d:git_version=\"$(GIT_VERSION)\"
|
||||||
|
|
||||||
|
ifeq ($(DEBUG), 0)
|
||||||
|
NIM_PARAMS := $(NIM_PARAMS) -d:release
|
||||||
|
else
|
||||||
|
NIM_PARAMS := $(NIM_PARAMS) -d:debug
|
||||||
|
endif
|
||||||
|
|
||||||
STATIC ?= 0
|
STATIC ?= 0
|
||||||
|
|
||||||
libsds: deps
|
libsds: deps
|
||||||
|
|||||||
@ -24,34 +24,34 @@ typedef void (*SdsCallBack) (int callerRet, const char* msg, size_t len, void* u
|
|||||||
// --- Core API Functions ---
|
// --- Core API Functions ---
|
||||||
|
|
||||||
|
|
||||||
void* NewReliabilityManager(const char* channelId, SdsCallBack callback, void* userData);
|
void* SdsNewReliabilityManager(const char* channelId, SdsCallBack callback, void* userData);
|
||||||
|
|
||||||
void SetEventCallback(void* ctx, SdsCallBack callback, void* userData);
|
void SdsSetEventCallback(void* ctx, SdsCallBack callback, void* userData);
|
||||||
|
|
||||||
int CleanupReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
int SdsCleanupReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
||||||
|
|
||||||
int ResetReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
int SdsResetReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
||||||
|
|
||||||
int WrapOutgoingMessage(void* ctx,
|
int SdsWrapOutgoingMessage(void* ctx,
|
||||||
void* message,
|
void* message,
|
||||||
size_t messageLen,
|
size_t messageLen,
|
||||||
const char* messageId,
|
const char* messageId,
|
||||||
SdsCallBack callback,
|
SdsCallBack callback,
|
||||||
void* userData);
|
void* userData);
|
||||||
|
|
||||||
int UnwrapReceivedMessage(void* ctx,
|
int SdsUnwrapReceivedMessage(void* ctx,
|
||||||
void* message,
|
void* message,
|
||||||
size_t messageLen,
|
size_t messageLen,
|
||||||
SdsCallBack callback,
|
SdsCallBack callback,
|
||||||
void* userData);
|
void* userData);
|
||||||
|
|
||||||
int MarkDependenciesMet(void* ctx,
|
int SdsMarkDependenciesMet(void* ctx,
|
||||||
char** messageIDs,
|
char** messageIDs,
|
||||||
size_t count,
|
size_t count,
|
||||||
SdsCallBack callback,
|
SdsCallBack callback,
|
||||||
void* userData);
|
void* userData);
|
||||||
|
|
||||||
int StartPeriodicTasks(void* ctx, SdsCallBack callback, void* userData);
|
int SdsStartPeriodicTasks(void* ctx, SdsCallBack callback, void* userData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -130,7 +130,7 @@ proc initializeLibrary() {.exported.} =
|
|||||||
################################################################################
|
################################################################################
|
||||||
### Exported procs
|
### Exported procs
|
||||||
|
|
||||||
proc NewReliabilityManager(
|
proc SdsNewReliabilityManager(
|
||||||
channelId: cstring, callback: SdsCallBack, userData: pointer
|
channelId: cstring, callback: SdsCallBack, userData: pointer
|
||||||
): pointer {.dynlib, exportc, cdecl.} =
|
): pointer {.dynlib, exportc, cdecl.} =
|
||||||
initializeLibrary()
|
initializeLibrary()
|
||||||
@ -170,14 +170,14 @@ proc NewReliabilityManager(
|
|||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
proc SetEventCallback(
|
proc SdsSetEventCallback(
|
||||||
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
||||||
) {.dynlib, exportc.} =
|
) {.dynlib, exportc.} =
|
||||||
initializeLibrary()
|
initializeLibrary()
|
||||||
ctx[].eventCallback = cast[pointer](callback)
|
ctx[].eventCallback = cast[pointer](callback)
|
||||||
ctx[].eventUserData = userData
|
ctx[].eventUserData = userData
|
||||||
|
|
||||||
proc CleanupReliabilityManager(
|
proc SdsCleanupReliabilityManager(
|
||||||
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
||||||
): cint {.dynlib, exportc.} =
|
): cint {.dynlib, exportc.} =
|
||||||
initializeLibrary()
|
initializeLibrary()
|
||||||
@ -193,7 +193,7 @@ proc CleanupReliabilityManager(
|
|||||||
|
|
||||||
return RET_OK
|
return RET_OK
|
||||||
|
|
||||||
proc ResetReliabilityManager(
|
proc SdsResetReliabilityManager(
|
||||||
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
||||||
): cint {.dynlib, exportc.} =
|
): cint {.dynlib, exportc.} =
|
||||||
initializeLibrary()
|
initializeLibrary()
|
||||||
@ -206,7 +206,7 @@ proc ResetReliabilityManager(
|
|||||||
userData,
|
userData,
|
||||||
)
|
)
|
||||||
|
|
||||||
proc WrapOutgoingMessage(
|
proc SdsWrapOutgoingMessage(
|
||||||
ctx: ptr SdsContext,
|
ctx: ptr SdsContext,
|
||||||
message: pointer,
|
message: pointer,
|
||||||
messageLen: csize_t,
|
messageLen: csize_t,
|
||||||
@ -237,7 +237,7 @@ proc WrapOutgoingMessage(
|
|||||||
userData,
|
userData,
|
||||||
)
|
)
|
||||||
|
|
||||||
proc UnwrapReceivedMessage(
|
proc SdsUnwrapReceivedMessage(
|
||||||
ctx: ptr SdsContext,
|
ctx: ptr SdsContext,
|
||||||
message: pointer,
|
message: pointer,
|
||||||
messageLen: csize_t,
|
messageLen: csize_t,
|
||||||
@ -262,7 +262,7 @@ proc UnwrapReceivedMessage(
|
|||||||
userData,
|
userData,
|
||||||
)
|
)
|
||||||
|
|
||||||
proc MarkDependenciesMet(
|
proc SdsMarkDependenciesMet(
|
||||||
ctx: ptr SdsContext,
|
ctx: ptr SdsContext,
|
||||||
messageIds: pointer,
|
messageIds: pointer,
|
||||||
count: csize_t,
|
count: csize_t,
|
||||||
@ -287,7 +287,7 @@ proc MarkDependenciesMet(
|
|||||||
userData,
|
userData,
|
||||||
)
|
)
|
||||||
|
|
||||||
proc StartPeriodicTasks(
|
proc SdsStartPeriodicTasks(
|
||||||
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
||||||
): cint {.dynlib, exportc.} =
|
): cint {.dynlib, exportc.} =
|
||||||
initializeLibrary()
|
initializeLibrary()
|
||||||
|
|||||||
21
sds.nimble
21
sds.nimble
@ -1,3 +1,5 @@
|
|||||||
|
mode = ScriptMode.Verbose
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
author = "Waku Team"
|
author = "Waku Team"
|
||||||
@ -6,9 +8,14 @@ license = "MIT"
|
|||||||
srcDir = "src"
|
srcDir = "src"
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
requires "nim >= 2.0.8"
|
requires "nim >= 2.2.4",
|
||||||
requires "chronicles"
|
"chronicles",
|
||||||
requires "libp2p"
|
"chronos",
|
||||||
|
"stew",
|
||||||
|
"stint",
|
||||||
|
"metrics",
|
||||||
|
"libp2p",
|
||||||
|
"results"
|
||||||
|
|
||||||
proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "static") =
|
proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "static") =
|
||||||
if not dirExists "build":
|
if not dirExists "build":
|
||||||
@ -35,5 +42,11 @@ task libsdsDynamic, "Generate bindings":
|
|||||||
let name = "libsds"
|
let name = "libsds"
|
||||||
buildLibrary name,
|
buildLibrary name,
|
||||||
"library/",
|
"library/",
|
||||||
"",
|
"""-d:chronicles_line_numbers \
|
||||||
|
-d:chronicles_runtime_filtering=on \
|
||||||
|
-d:chronicles_sinks="textlines,json" \
|
||||||
|
-d:chronicles_default_output_device=Dynamic \
|
||||||
|
--warning:Deprecated:off \
|
||||||
|
--warning:UnusedImport:on \
|
||||||
|
-d:chronicles_log_level=TRACE """,
|
||||||
"dynamic"
|
"dynamic"
|
||||||
2
vendor/nimbus-build-system
vendored
2
vendor/nimbus-build-system
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5f10509cf880dc035e517ca7bac3163cd5206ba8
|
Subproject commit 0be0663e1af76e869837226a4ef3e586fcc737d3
|
||||||
Loading…
x
Reference in New Issue
Block a user