Ivan FB 5ecab737ae
feat: adapt bindings to nim-sds v0.2 CBOR sds_* ABI
nim-sds now builds on nim-ffi 0.2, whose wire format is CBOR (not JSON)
and whose events use a per-event listener registry. Rewrite the cgo layer
to match:

- requests/responses are CBOR (fxamacker/cbor); seq[byte] is a CBOR byte
  string; request params are wrapped under their Nim param name ("req"/
  "config"). No-arg methods send an empty CBOR map (0xa0).
- register one listener per event via sds_add_event_listener; decode the
  CBOR EventEnvelope {eventType,payload}. Adds OnRepairReady.
- copy the result payload during the callback (libsds frees it on return)
  and key the waiter by the C resp pointer in a sync.Map with LoadAndDelete
  (winner-takes-all) — no Go pointer is stored in C memory, and a late or
  duplicate delivery cannot double-close or touch a freed resp.
- guard the manager registry with a RWMutex (callbacks run on libsds
  threads).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 23:29:38 +02:00
2025-12-22 16:45:14 +00:00
2025-04-16 18:38:09 +03:00

SDS Go Bindings

This repository provides Go bindings for the SDS library, enabling seamless integration with Go projects.

Installation

To build the required dependencies for this module, the make command needs to be executed. If you are integrating this module into another project via go get, ensure that you navigate to the sds-go-bindings/sds directory and run make.

Steps to Install

Follow these steps to install and set up the module:

  1. Retrieve the module using go get:
    go get -u github.com/waku-org/sds-go-bindings
    
  2. Navigate to the module's directory:
    cd $(go list -m -f '{{.Dir}}' github.com/waku-org/sds-go-bindings)
    
  3. Prepare third_party directory which will clone nim-sds
    sudo mkdir third_party
    sudo chown $USER third_party
    
  4. Build the dependencies:
    make -C sds
    

Now the module is ready for use in your project.

Note

In order to easily build the libsds library on demand, it is recommended to add the following target in your project's Makefile:

LIBSDS_DEP_PATH=$(shell go list -m -f '{{.Dir}}' github.com/waku-org/sds-go-bindings)

buildlib:
   cd $(LIBSDS_DEP_PATH) &&\
   sudo mkdir -p third_party &&\
   sudo chown $(USER) third_party &&\
   make -C sds
Description
No description provided
Readme
Languages
Go 96.1%
Makefile 3.9%