Ivan FB a5a47f8e6e
feat: port bindings to nim-ffi 0.2.0 snake_case + CBOR libsds ABI
nim-sds built on nim-ffi 0.2.0 exports a new C ABI (snake_case symbols,
CBOR-marshalled requests/responses, named event-listener registry),
which the old PascalCase callback-based bindings could not link against
(undefined reference to SdsWrapOutgoingMessage / SdsUnwrapReceivedMessage).

Rewrite the cgo layer to the new ABI while keeping the Go-facing API
identical so consumers (status-go reliability layer) need no changes:

- sds_schema.go: CBOR structs matching nim-sds library/libsds.nim. The
  .ffi. macro wraps each proc's non-ctx params in a generated request
  object keyed by the param name, so requests are nested ({req:{...}});
  no-extra-param procs take {_placeholder: uint8}.
- sds.go: snake_case wrappers; callback copies the callback-scoped CBOR
  buffer before returning to avoid a use-after-free.
- sds_common.go: event path decodes the CBOR {eventType, payload}
  envelope instead of JSON.
- NewReliabilityManager passes an empty participantId (plain SDS, SDS-R
  repair disabled) to preserve pre-nim-ffi behavior.

Validated: full binding test suite (incl. event callbacks) passes
against a libsds built from nim-ffi 0.2.0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 23:11:28 +02:00

19 lines
428 B
Modula-2

module github.com/waku-org/sds-go-bindings
go 1.24.0
require (
github.com/fxamacker/cbor/v2 v2.9.2
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.1
go.uber.org/zap v1.27.0
)
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.10.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)