@startuml "GraphSync" package "go-ipld-prime" { interface Node { } interface Selector { } } package "go-graphsync" { class GraphSync { network : GraphySyncNetwork requestManager : RequestManager responseManager: ResponseManager Request(p peer.ID, selector Selector, root Cid) chan Block ReceiveMessage(ctx context.Context, sender peer.ID, incoming GraphSyncMessage) ReceiveError(error) } package network { interface Receiver { ReceiveMessage(ctx context.Context, sender peer.ID, incoming GraphSyncMessage) ReceiveError(error) } interface GraphSyncNetwork { SendMessage(ctx context.Context, receiver peer.Id, m GraphSyncMessage) SetDelegate(receiver Receiver) ConnectTo(ctx context.Context, peer.ID) error NewMessageSender(context.Context, peer.ID) (MessageSender, error) } interface MessageSender { SendMsg(context.Context, GraphSyncMessage) error Close() error Reset() error } Receiver <|-- GraphSync : receiver for class libP2PGraphSyncNetwork { } GraphSyncNetwork <|-- libP2PGraphSyncNetwork object "Package Public Functions" as goGraphSyncNetworkPF { NewLibP2PNetwork(host libp2pHost.Host) GraphSyncNetwork } goGraphSyncNetworkPF .. libP2PGraphSyncNetwork } package requestmanager { class RequestManager { network : GraphSyncNetwork SendRequest(p peer.ID, selector Selector, root Cid) chan Block ProcessResponses(responses []GraphSyncResponse) } RequestManager *-- GraphSyncNetwork GraphSync *-- RequestManager } package responsemanager { class ResponseManager { network : GraphySyncNetwork ProcessRequests(p peer.ID, requests []GraphSyncRequests) } ResponseManager *-- GraphSyncNetwork GraphSync *-- ResponseManager } package message { object "Package Public Functions" as goGraphSyncMessagePF { func FromPBReader(pbr ggio.Reader) (GraphSyncMessage, error) func FromNet(r io.Reader) (GraphSyncMessage, error) } goGraphSyncMessagePF .. libP2PGraphSyncNetwork interface GraphSyncRequest { Selector() []bytes Priority() Priority ID() int IsCancel() bool } interface GraphSyncResponse { RequestID() int Status() GraphSyncStatus Extra() []bytes } interface GraphSyncMessage { Requests() : []GraphSyncRequest Responses() : []GraphSyncResponse Blocks() : []Blocks } interface Exportable { ToProto() ToNet(w io.Writer) error } Exportable --|> GraphSyncMessage GraphSyncRequest --* GraphSyncMessage GraphSyncResponse --* GraphSyncMessage } object "PackagePublicFunctions" as goGraphsyncPf { New(ctx context.Context, network GraphSyncNetwork) GraphSync } } package "go-filecoin" { class "go-filecoin" { graphSync : GraphSync host: libp2pHost.Host } "go-filecoin" *-- GraphSync "go-filecoin" .. goGraphsyncPf "go-filecoin" .. goGraphSyncNetworkPF "go-filecoin" .. Selector } @enduml