feat: swarm membership discovery via peer-list gossip

Refs #1

- /v1/ping now advertises the node's known peers (peer_id, addr, name)
- Run sweeps static KNOX_PEERS + persisted discovered peers, enqueueing
  newly-learned addresses for direct sweeps (membership-only relay; no
  observation relay)
- db: ShareablePeers, SwarmPeerAddrs, MergePeer (cursor-preserving
  discovery upsert), MaxHCLForNode
- integration test: a node configured with a single seed discovers and
  pulls from other swarm members without direct configuration
This commit is contained in:
2026-08-29 05:41:52 -07:00
parent 48e9c39d7b
commit 25a7112d8a
6 changed files with 204 additions and 20 deletions
+6
View File
@@ -142,6 +142,12 @@ func Open(path string) (*KnoxDB, error) {
return nil, fmt.Errorf("create locator index: %w", err)
}
// Thread idempotency index must come after the cluster_key migration (a
// fresh DB has the column from Schema; an existing DB gets it above).
if _, err := db.Exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_threads_cluster ON threads(cluster_key) WHERE cluster_key IS NOT NULL AND cluster_key != ''`); err != nil {
return nil, fmt.Errorf("create cluster_key index: %w", err)
}
return kdb, nil
}