42 lines
1.7 KiB
Plaintext
42 lines
1.7 KiB
Plaintext
|
|
@startuml
|
||
|
|
title Native Indexer — Enregistrement d'un Indexer auprès du Native
|
||
|
|
|
||
|
|
participant "Indexer A" as IndexerA
|
||
|
|
participant "Indexer B" as IndexerB
|
||
|
|
participant "Native Indexer (partagé)" as Native
|
||
|
|
participant "DHT Kademlia" as DHT
|
||
|
|
participant "GossipSub (oc-indexer-registry)" as PubSub
|
||
|
|
|
||
|
|
note over IndexerA,IndexerB: Au démarrage + toutes les 60s (StartNativeRegistration)
|
||
|
|
|
||
|
|
par Indexer A s'enregistre
|
||
|
|
IndexerA -> IndexerA: Build IndexerRegistration{PeerID_A, Addr_A}
|
||
|
|
IndexerA -> Native: NewStream /opencloud/native/subscribe/1.0
|
||
|
|
IndexerA -> Native: json.Encode(IndexerRegistration A)
|
||
|
|
|
||
|
|
Native -> Native: Decode → liveIndexerEntry{PeerID_A, Addr_A, ExpiresAt=now+66s}
|
||
|
|
Native -> DHT: PutValue("/indexer/"+PeerID_A, entry A)
|
||
|
|
DHT --> Native: ok
|
||
|
|
Native -> Native: liveIndexers[PeerID_A] = entry A
|
||
|
|
Native -> Native: knownPeerIDs[PeerID_A] = {}
|
||
|
|
|
||
|
|
Native -> PubSub: topic.Publish([]byte(PeerID_A))
|
||
|
|
note over PubSub: Gossipé aux autres Natives\n→ ils ajoutent PeerID_A à knownPeerIDs\n→ refresh DHT au prochain tick 30s
|
||
|
|
IndexerA -> Native: stream.Close()
|
||
|
|
else Indexer B s'enregistre
|
||
|
|
IndexerB -> IndexerB: Build IndexerRegistration{PeerID_B, Addr_B}
|
||
|
|
IndexerB -> Native: NewStream /opencloud/native/subscribe/1.0
|
||
|
|
IndexerB -> Native: json.Encode(IndexerRegistration B)
|
||
|
|
|
||
|
|
Native -> Native: Decode → liveIndexerEntry{PeerID_B, Addr_B, ExpiresAt=now+66s}
|
||
|
|
Native -> DHT: PutValue("/indexer/"+PeerID_B, entry B)
|
||
|
|
DHT --> Native: ok
|
||
|
|
Native -> Native: liveIndexers[PeerID_B] = entry B
|
||
|
|
Native -> PubSub: topic.Publish([]byte(PeerID_B))
|
||
|
|
IndexerB -> Native: stream.Close()
|
||
|
|
end par
|
||
|
|
|
||
|
|
note over Native: liveIndexers = {PeerID_A: entryA, PeerID_B: entryB}
|
||
|
|
|
||
|
|
@enduml
|