Files
Igor Sirotin c3768ff3fc refactor: address review on the Node facades
Move the Messaging API back out of pkg/kernel: ffi.Handle becomes a
defined type in the internal package, so kernel can hand the context to
pkg/messaging through kernel.Handle without the kernel layer knowing the
tier exists, and without the type being nameable outside this module.

Split Discovery into DiscV5, PeerExchange and DNSDiscovery, group the
node's identity and health under Debug(), and give every facade a pointer
receiver. Drop the node name, the per-operation logging that duplicates
what the library already writes, and GetFreePortIfNeeded — port 0 already
means "let the OS pick".

Heavy kernel tests now mark themselves with requiresNode and skip under
-short, so the gate runs `go test -short ./...` instead of naming tests
in a regexp.
2026-08-25 00:46:13 +01:00

26 lines
1.0 KiB
Go

// Package kernel is the Go wrapper over a logos-delivery node.
//
// Node owns the library context, and is the only place the underlying FFI
// handle lives. The kernel protocols are reached through facades taken from a
// Node, one per protocol:
//
// node, err := kernel.New(kernel.Config{Preset: kernel.PresetLogosDev})
// defer node.Close()
// node.Start()
//
// node.Relay().Subscribe(pubsubTopic)
// node.Peers().Connect(ctx, addr)
// resp, err := node.Store().Query(ctx, request, peerInfo)
// id, err := node.Debug().PeerID()
//
// The grouping mirrors the C library's own modules: Relay, Store, Peers,
// DiscV5, PeerExchange, DNSDiscovery and Debug map onto
// kernel_api/protocols/relay_api.nim, store_api.nim, peer_manager_api.nim,
// discovery_api.nim and debug_node_api.nim. Node itself carries only the
// lifecycle.
//
// This package knows nothing of the Messaging API. That tier lives in
// pkg/messaging, whose MessagingClient drives a Node and exposes it, so both
// tiers run against one node.
package kernel