2026-03-09 14:57:41 +01:00
|
|
|
@startuml native_registration
|
|
|
|
|
title Native Indexer — Indexer Subscription (StartNativeRegistration)
|
2026-02-24 14:31:37 +01:00
|
|
|
|
|
|
|
|
participant "Indexer A" as IndexerA
|
|
|
|
|
participant "Indexer B" as IndexerB
|
2026-03-09 14:57:41 +01:00
|
|
|
participant "Native Indexer" as Native
|
2026-02-24 14:31:37 +01:00
|
|
|
participant "DHT Kademlia" as DHT
|
|
|
|
|
participant "GossipSub (oc-indexer-registry)" as PubSub
|
|
|
|
|
|
2026-03-09 14:57:41 +01:00
|
|
|
note over IndexerA,IndexerB: At start + every 60s (RecommendedHeartbeatInterval)\\nStartNativeRegistration → RegisterWithNative
|
|
|
|
|
|
|
|
|
|
par Indexer A subscribe
|
|
|
|
|
IndexerA -> IndexerA: fillRateFn()\\n= len(StreamRecords[HB]) / maxNodes
|
|
|
|
|
|
|
|
|
|
IndexerA -> IndexerA: Build IndexerRegistration{\\n PeerID_A, Addr_A,\\n Timestamp=now.UnixNano(),\\n FillRate=fillRateFn(),\\n PubKey, Signature\\n}\\nreg.Sign(h)
|
2026-02-24 14:31:37 +01:00
|
|
|
|
|
|
|
|
IndexerA -> Native: NewStream /opencloud/native/subscribe/1.0
|
2026-03-09 14:57:41 +01:00
|
|
|
IndexerA -> Native: stream.Encode(IndexerRegistration A)
|
|
|
|
|
|
|
|
|
|
Native -> Native: reg.Verify() — verify signature
|
|
|
|
|
Native -> Native: liveIndexerEntry{\\n PeerID_A, Addr_A,\\n ExpiresAt = now + IndexerTTL (90s),\\n FillRate = reg.FillRate,\\n PubKey, Signature\\n}
|
|
|
|
|
Native -> Native: liveIndexers[PeerID_A] = entry A
|
|
|
|
|
Native -> Native: knownPeerIDs[PeerID_A] = Addr_A
|
2026-02-24 14:31:37 +01:00
|
|
|
|
|
|
|
|
Native -> DHT: PutValue("/indexer/"+PeerID_A, entry A)
|
|
|
|
|
DHT --> Native: ok
|
|
|
|
|
|
|
|
|
|
Native -> PubSub: topic.Publish([]byte(PeerID_A))
|
2026-03-09 14:57:41 +01:00
|
|
|
note over PubSub: Gossip to other Natives\\n→ it adds PeerID_A to knownPeerIDs\\n→ refresh DHT next tick (30s)
|
|
|
|
|
|
2026-02-24 14:31:37 +01:00
|
|
|
IndexerA -> Native: stream.Close()
|
2026-03-09 14:57:41 +01:00
|
|
|
|
|
|
|
|
else Indexer B subscribe
|
|
|
|
|
IndexerB -> IndexerB: fillRateFn() + reg.Sign(h)
|
2026-02-24 14:31:37 +01:00
|
|
|
IndexerB -> Native: NewStream /opencloud/native/subscribe/1.0
|
2026-03-09 14:57:41 +01:00
|
|
|
IndexerB -> Native: stream.Encode(IndexerRegistration B)
|
2026-02-24 14:31:37 +01:00
|
|
|
|
2026-03-09 14:57:41 +01:00
|
|
|
Native -> Native: reg.Verify() + liveIndexerEntry{FillRate=reg.FillRate, ExpiresAt=now+90s}
|
2026-02-24 14:31:37 +01:00
|
|
|
Native -> Native: liveIndexers[PeerID_B] = entry B
|
2026-03-09 14:57:41 +01:00
|
|
|
Native -> DHT: PutValue("/indexer/"+PeerID_B, entry B)
|
2026-02-24 14:31:37 +01:00
|
|
|
Native -> PubSub: topic.Publish([]byte(PeerID_B))
|
|
|
|
|
IndexerB -> Native: stream.Close()
|
|
|
|
|
end par
|
|
|
|
|
|
2026-03-09 14:57:41 +01:00
|
|
|
note over Native: liveIndexers = {PeerID_A: {FillRate:0.3}, PeerID_B: {FillRate:0.6}}\\nTTL 90s — IndexerTTL
|
|
|
|
|
|
|
|
|
|
note over Native: Explicit unsubcrive on stop :\\nUnregisterFromNative → /opencloud/native/unsubscribe/1.0\\nNative close all now.
|
2026-02-24 14:31:37 +01:00
|
|
|
|
|
|
|
|
@enduml
|