@startuml "GraphSync" package "go-ipld-prime" { interface Node { } interface NodeBuilder { } interface Path { } package traversal { package selector { interface Selector { } object "PackagePublicFunctions" as goSelectorPF { ReifySelector(cidRootedSelector Node) (Selector, error) } } interface AdvVisitFn { } class TraversalConfig { ctx context.Context linkLoader LinkLoader } class TraversalProgress { TraverseInformatively(Node, Selector, AdvVisitFn) } TraversalProgress *-- TraversalConfig } package repose { interface RawLoader { } interface MulticodecDecodeTable { } interface NodeBuilderChooser { } interface LinkLoader { } object "Package Public Functions" as goIPLDReposePf { ComposeLinkLoader(RawLoader, NodeBuilderChooser, MulticodecDecodeTable) EncoderDagCbor(Node, io.Writer) DecodeDagCbor(NodeBuilder, io.Writer) } } } package "go-graphsync" { class GraphSync { network : GraphySyncNetwork requestManager : RequestManager responseManager: ResponseManager ipldBridge: IPLDBridge rawLoader: RawLoader Request(ctx context.Context, p peer.ID, cidRootedSelector Node) chan Block ReceiveMessage(ctx context.Context, sender peer.ID, incoming GraphSyncMessage) ReceiveError(error) } GraphSync *-- RawLoader 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 ipldBridge: GraphSyncNetwork SendRequest(ctx context.Context, p peer.ID, cidRootedSelector Node) chan Block ProcessResponses(responses []GraphSyncResponse) } RequestManager *-- GraphSyncNetwork GraphSync *-- RequestManager } package responsemanager { class ResponseManager { network : GraphySyncNetwork ipldBridge: IPLDBridge rawLoader: RawLoader ProcessRequests(p peer.ID, requests []GraphSyncRequests) } ResponseManager *-- GraphSyncNetwork GraphSync *-- ResponseManager ResponseManager *-- RawLoader } 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 } package ipldbridge { interface IPLDBridge { ComposeLinkLoader(actualLoader RawLoader) LinkLoader ValidateSelectorSpec(cidRootedSelector ipld.Node) []error EncodeNode(ipld.Node) ([]byte, error) DecodeNode([]byte) (ipld.Node, error) DecodeSelectorSpec(cidRootedSelector ipld.Node) (ipld.Node, Selector, error) Traverse(ctx context.Context, loader LinkLoader, root ipld.Node, s Selector, fn AdvVisitFn) error } GraphSync *-- IPLDBridge RequestManager *-- IPLDBridge ResponseManager *-- IPLDBridge class ipldBridge { nodeBuilderChooser: NodeBuilderChooser multicodecTable: MulticodecDecodeTable } object "PackagePublicFunctions" as goIPLDBridge { NewIPLDBridge(nodeBuilderChooser NodeBuilderChooser, multicodecTable MulticodecDecodeTable) IPLDBridge } IPLDBridge <|-- ipldBridge goIPLDBridge .. ipldBridge ipldBridge *-- MulticodecDecodeTable ipldBridge *-- NodeBuilderChooser ipldBridge .. TraversalProgress ipldBridge .. goSelectorPF ipldBridge .. goIPLDReposePf } object "PackagePublicFunctions" as goGraphsyncPf { New(ctx context.Context, network GraphSyncNetwork, rawLoader RawLoader, multicodecDecodeTable MulticodecDecodeTable, nodeBuilderChooser NodeBuilderChooser) GraphSync } } package "go-filecoin" { class "go-filecoin" { graphSync : GraphSync host: libp2pHost.Host nodeBuilderChooser: NodeBuilderChooser multicodecTable: MulticodecDecodeTable rawLoader: RawLoader } "go-filecoin" *-- GraphSync "go-filecoin" .. goGraphsyncPf "go-filecoin" .. goGraphSyncNetworkPF "go-filecoin" .. goIPLDBridge "go-filecoin" *-- RawLoader "go-filecoin" *-- MulticodecDecodeTable "go-filecoin" *-- NodeBuilderChooser } @enduml