feat: define traceContentLookupRes

This commit is contained in:
fearlessfe 2024-03-06 23:28:29 +08:00 committed by Chen Kai
parent 12cbf8de50
commit 6ef3b11b69
2 changed files with 18 additions and 0 deletions

View file

@ -46,6 +46,22 @@ type ContentInfo struct {
UtpTransfer bool `json:"utpTransfer"`
}
type TraceContentResult struct {
Content string `json:"content"`
UtpTransfer bool `json:"utpTransfer"`
Trace Trace `json:"trace"`
}
type Trace struct {
Origin string `json:"origin"` // local node id
TargetId string `json:"targetId"` // target content id
ReceivedFrom string `json:"receivedFrom"` // the node id of which content from
Responses map[string]ContentInfo `json:"responses"` // the node id and there response
Metadata map[string]any `json:"metadata"` // node id and there metadata object
StartedAtMs int `json:"startedAtMs"` // timestamp of the beginning of this request in milliseconds
Cancelled []string `json:"cancelled"` // the node ids which are send but cancelled
}
type Enrs struct {
Enrs []string `json:"enrs"`
}

View file

@ -1499,6 +1499,8 @@ func (p *PortalProtocol) contentLookupWorker(n *enode.Node, contentKey []byte, r
return wrapedNode, nil
}
// func (p *PortalProtocol) traceContentLookupWorker()
func (p *PortalProtocol) ToContentId(contentKey []byte) []byte {
return p.toContentId(contentKey)
}