Commit b6c8a00e authored by hannahhoward's avatar hannahhoward

docs(architecture diagram): use bridge

Update the architecture diagram to reflect the latest changes and understanding of the various
libraries

fix #4
parent 8d991f8d
...@@ -4,11 +4,51 @@ ...@@ -4,11 +4,51 @@
package "go-ipld-prime" { package "go-ipld-prime" {
interface Node { 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
} }
interface Selector {
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" { package "go-graphsync" {
...@@ -17,11 +57,16 @@ package "go-graphsync" { ...@@ -17,11 +57,16 @@ package "go-graphsync" {
network : GraphySyncNetwork network : GraphySyncNetwork
requestManager : RequestManager requestManager : RequestManager
responseManager: ResponseManager responseManager: ResponseManager
Request(p peer.ID, selector Selector, root Cid) chan Block ipldBridge: IPLDBridge
rawLoader: RawLoader
Request(ctx context.Context, p peer.ID, cidRootedSelector Node) chan Block
ReceiveMessage(ctx context.Context, sender peer.ID, incoming GraphSyncMessage) ReceiveMessage(ctx context.Context, sender peer.ID, incoming GraphSyncMessage)
ReceiveError(error) ReceiveError(error)
} }
GraphSync *-- RawLoader
package network { package network {
interface Receiver { interface Receiver {
...@@ -58,8 +103,9 @@ package "go-graphsync" { ...@@ -58,8 +103,9 @@ package "go-graphsync" {
package requestmanager { package requestmanager {
class RequestManager { class RequestManager {
network : GraphSyncNetwork network : GraphSyncNetwork
ipldBridge: GraphSyncNetwork
SendRequest(p peer.ID, selector Selector, root Cid) chan Block SendRequest(ctx context.Context, p peer.ID, cidRootedSelector Node) chan Block
ProcessResponses(responses []GraphSyncResponse) ProcessResponses(responses []GraphSyncResponse)
} }
RequestManager *-- GraphSyncNetwork RequestManager *-- GraphSyncNetwork
...@@ -69,10 +115,14 @@ package "go-graphsync" { ...@@ -69,10 +115,14 @@ package "go-graphsync" {
package responsemanager { package responsemanager {
class ResponseManager { class ResponseManager {
network : GraphySyncNetwork network : GraphySyncNetwork
ipldBridge: IPLDBridge
rawLoader: RawLoader
ProcessRequests(p peer.ID, requests []GraphSyncRequests) ProcessRequests(p peer.ID, requests []GraphSyncRequests)
} }
ResponseManager *-- GraphSyncNetwork ResponseManager *-- GraphSyncNetwork
GraphSync *-- ResponseManager GraphSync *-- ResponseManager
ResponseManager *-- RawLoader
} }
package message { package message {
object "Package Public Functions" as goGraphSyncMessagePF { object "Package Public Functions" as goGraphSyncMessagePF {
...@@ -111,8 +161,39 @@ package "go-graphsync" { ...@@ -111,8 +161,39 @@ package "go-graphsync" {
} }
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 { object "PackagePublicFunctions" as goGraphsyncPf {
New(ctx context.Context, network GraphSyncNetwork) GraphSync New(ctx context.Context, network GraphSyncNetwork, rawLoader RawLoader, multicodecDecodeTable MulticodecDecodeTable, nodeBuilderChooser NodeBuilderChooser) GraphSync
} }
} }
...@@ -121,12 +202,18 @@ package "go-filecoin" { ...@@ -121,12 +202,18 @@ package "go-filecoin" {
class "go-filecoin" { class "go-filecoin" {
graphSync : GraphSync graphSync : GraphSync
host: libp2pHost.Host host: libp2pHost.Host
nodeBuilderChooser: NodeBuilderChooser
multicodecTable: MulticodecDecodeTable
rawLoader: RawLoader
} }
"go-filecoin" *-- GraphSync "go-filecoin" *-- GraphSync
"go-filecoin" .. goGraphsyncPf "go-filecoin" .. goGraphsyncPf
"go-filecoin" .. goGraphSyncNetworkPF "go-filecoin" .. goGraphSyncNetworkPF
"go-filecoin" .. Selector "go-filecoin" .. goIPLDBridge
"go-filecoin" *-- RawLoader
"go-filecoin" *-- MulticodecDecodeTable
"go-filecoin" *-- NodeBuilderChooser
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment