Skip to content

Commit 6ef3b11

Browse files
fearlessfeGrapeBaBa
authored andcommitted
feat: define traceContentLookupRes
1 parent 12cbf8d commit 6ef3b11

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

p2p/discover/api.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ type ContentInfo struct {
4646
UtpTransfer bool `json:"utpTransfer"`
4747
}
4848

49+
type TraceContentResult struct {
50+
Content string `json:"content"`
51+
UtpTransfer bool `json:"utpTransfer"`
52+
Trace Trace `json:"trace"`
53+
}
54+
55+
type Trace struct {
56+
Origin string `json:"origin"` // local node id
57+
TargetId string `json:"targetId"` // target content id
58+
ReceivedFrom string `json:"receivedFrom"` // the node id of which content from
59+
Responses map[string]ContentInfo `json:"responses"` // the node id and there response
60+
Metadata map[string]any `json:"metadata"` // node id and there metadata object
61+
StartedAtMs int `json:"startedAtMs"` // timestamp of the beginning of this request in milliseconds
62+
Cancelled []string `json:"cancelled"` // the node ids which are send but cancelled
63+
}
64+
4965
type Enrs struct {
5066
Enrs []string `json:"enrs"`
5167
}

p2p/discover/portal_protocol.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,8 @@ func (p *PortalProtocol) contentLookupWorker(n *enode.Node, contentKey []byte, r
14991499
return wrapedNode, nil
15001500
}
15011501

1502+
// func (p *PortalProtocol) traceContentLookupWorker()
1503+
15021504
func (p *PortalProtocol) ToContentId(contentKey []byte) []byte {
15031505
return p.toContentId(contentKey)
15041506
}

0 commit comments

Comments
 (0)