55 lines
2.2 KiB
Plaintext
55 lines
2.2 KiB
Plaintext
@startuml
|
|
title PubSub — Recherche gossip globale (type "all") : Pair A cherche, Pair B répond
|
|
|
|
participant "App Pair A" as AppA
|
|
participant "NATS A" as NATSA
|
|
participant "Node A" as NodeA
|
|
participant "PubSubService A" as PubSubA
|
|
participant "GossipSub libp2p (mesh)" as GossipSub
|
|
participant "Node B" as NodeB
|
|
participant "PubSubService B" as PubSubB
|
|
participant "DB Pair B (oc-lib)" as DBB
|
|
participant "StreamService B" as StreamB
|
|
participant "StreamService A" as StreamA
|
|
|
|
AppA -> NATSA: Publish(PROPALGATION_EVENT, {PB_SEARCH, type:"all", search:"gpu"})
|
|
NATSA -> NodeA: ListenNATS → PB_SEARCH (type "all")
|
|
|
|
NodeA -> PubSubA: SearchPublishEvent(ctx, dt, "all", user, "gpu")
|
|
PubSubA -> PubSubA: publishEvent(PB_SEARCH, user, {search:"gpu"})
|
|
PubSubA -> PubSubA: GenerateNodeID() → from = DID_A
|
|
PubSubA -> PubSubA: priv_A.Sign(event body) → sig
|
|
PubSubA -> PubSubA: Build Event{Type:"search", From:DID_A, Payload:{search:"gpu"}, Sig}
|
|
|
|
PubSubA -> GossipSub: topic.Join("search")
|
|
PubSubA -> GossipSub: topic.Publish(ctx, json(Event))
|
|
|
|
GossipSub --> NodeB: Message propagé (gossip mesh)
|
|
|
|
NodeB -> PubSubB: subscribeEvents écoute topic "search#"
|
|
PubSubB -> PubSubB: json.Unmarshal → Event{From: DID_A}
|
|
|
|
PubSubB -> NodeB: GetPeerRecord(ctx, DID_A)
|
|
note over NodeB: Résolution Pair A via DB B ou Indexer
|
|
NodeB --> PubSubB: Peer A {PublicKey_A, Relation, ...}
|
|
|
|
PubSubB -> PubSubB: event.Verify(Peer A) → valide sig_A
|
|
PubSubB -> PubSubB: handleEventSearch(ctx, evt, PB_SEARCH)
|
|
|
|
PubSubB -> StreamB: SendResponse(Peer A, evt)
|
|
StreamB -> DBB: Search(COMPUTE + STORAGE + ..., filters{creator=self, access=PUBLIC OR partnerships[PeerID_A]}, search="gpu")
|
|
DBB --> StreamB: [Resource1, Resource2, ...]
|
|
|
|
loop Pour chaque ressource matchée
|
|
StreamB -> StreamB: write(PeerID_A, addr_A, dt, resource JSON, ProtocolSearchResource)
|
|
StreamB -> StreamA: NewStream /opencloud/resource/search/1.0
|
|
StreamB -> StreamA: json.Encode(Event{Type:search, From:DID_B, DataType, Payload:resource})
|
|
end
|
|
|
|
StreamA -> StreamA: readLoop → handleEvent(ProtocolSearchResource, evt)
|
|
StreamA -> StreamA: retrieveResponse(evt)
|
|
StreamA -> NATSA: SetNATSPub(SEARCH_EVENT, {DataType, resource JSON})
|
|
NATSA -> AppA: Résultats de recherche de Pair B
|
|
|
|
@enduml
|