Add the streamrNode* full-node API (phase D3b) on shared library 3.0.0#1
Open
ptesavol wants to merge 1 commit into
Open
Add the streamrNode* full-node API (phase D3b) on shared library 3.0.0#1ptesavol wants to merge 1 commit into
ptesavol wants to merge 1 commit into
Conversation
- Vendor the 3.0.0 headers: streamrcommon.h (the renamed shared infrastructure), streamrproxyclient.h (proxy API + deprecated pre-3.0 aliases) and streamrnode.h. The proxy shim keeps resolving the old C symbol names, which 3.0.0 still exports as deprecated aliases. - shim: dlsym the streamrNode* functions; a C trampoline bridges the message callback to the cgo-exported goStreamrNodeMessage with a Go-side registry key in userData; a small accessor reads the StreamrError peer/proxy union member (cgo cannot address anonymous union members). - streamrnode.go: StreamrNode API (New/Close, Start/Stop, Join/LeaveStreamPart, Publish, Subscribe/Unsubscribe, NeighborCount, SetProxies) following the existing wrapper conventions. Peer arrays passed inside C structs are C-allocated (cgo forbids Go pointers in structs passed to C). Callback registrations live until Close: the C API may still dispatch a message whose delivery already started when Unsubscribe returns. - Library loading is now once-per-process and never dlclosed: a node that has run leaves service threads pinning the library, so a fresh dlopen after dlclose loaded a SECOND copy and aborted on duplicate gflags registration. In-process cleanup/re-init uses the C API's own lifecycle on the single loaded copy (supported since 3.0.0). - dist: refresh the embedded arm64-osx dylib to 3.0.0. The other platforms' embedded libraries still need their 3.0.0 builds from the native-sdk release pipeline before this branch is released. - streamrnode_test.go: two wrapper-created nodes form a stream-part topology and exchange a signed and an unsigned message, plus error mapping; full suite (proxy + node) passes in one process. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the Go wrapper with the full-node API, completing its part of native-sdk phase D3b (see streamr-dev/native-sdk#95, which renames the shared C API infrastructure and bundles the C++/Python wrapper extensions).
StreamrNodeGo API:NewStreamrNode/Close,Start/Stop,JoinStreamPart/LeaveStreamPart,Publish,Subscribe(Go closure callback) /Unsubscribe,NeighborCount,SetProxies— following the existing wrapper conventions.streamrNode*functions; C trampoline → cgo-exported callback with a registry key; accessor for theStreamrErrorpeer/proxy anonymous-union member (cgo can't address those).Close(the C API may still dispatch a message whose delivery already started atUnsubscribe).Tests: new two-node round-trip (topology forms, signed + unsigned message exchange, error mapping) plus the existing proxy suite — all green in one process (
go test -skip=TestPublishToServer, 3.1 s on arm64-osx).🤖 Generated with Claude Code