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
2026-01-06 02:44:56 +07:00
2026-01-06 01:52:37 +07:00