40 lines
1.8 KiB
Plaintext
40 lines
1.8 KiB
Plaintext
|
|
sequenceDiagram
|
||
|
|
title Native Indexer — Enregistrement d'un Indexer auprès du Native
|
||
|
|
|
||
|
|
participant IndexerA as Indexer A
|
||
|
|
participant IndexerB as Indexer B
|
||
|
|
participant Native as Native Indexer (partagé)
|
||
|
|
participant DHT as DHT Kademlia
|
||
|
|
participant PubSub as GossipSub (oc-indexer-registry)
|
||
|
|
|
||
|
|
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<br/>→ ils ajoutent PeerID_A à knownPeerIDs<br/>→ refresh DHT au prochain tick 30s
|
||
|
|
IndexerA->>Native: stream.Close()
|
||
|
|
and 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
|
||
|
|
|
||
|
|
Note over Native: liveIndexers = {PeerID_A: entryA, PeerID_B: entryB}
|