MCPcopy Create free account
hub / github.com/Azure/peerd / FstatRemote

Method FstatRemote

pkg/discovery/content/reader/reader.go:79–98  ·  view source on GitHub ↗

FstatRemote stats a remote file.

()

Source from the content-addressed store, hash-verified

77
78// FstatRemote stats a remote file.
79func (r *reader) FstatRemote() (int64, error) {
80 key := r.context.GetString(pcontext.FileChunkCtxKey)
81 start := int64(0)
82 end := int64(0)
83
84 log := r.Log().With().Str("operation", "fstatremote").Int64("start", start).Int64("end", end).Str("key", key).Logger()
85
86 startTime := time.Now()
87 originReq, err := r.originRequest(start, end)
88 if err != nil {
89 return -1, err
90 }
91
92 var count int64
93 defer func() {
94 r.metricsRecorder.RecordUpstreamResponse(originReq.URL.Hostname(), key, "fstat", time.Since(startTime).Seconds(), count)
95 }()
96 count, err = r.fstatRemote(log, originReq, r.defaultHttpClient)
97 return count, err
98}
99
100// doP2p tries to resolve the key in the p2p network and if successful, it will perform the operation on the peer, and return the result.
101func (r *reader) doP2p(log zerolog.Logger, fileChunkKey string, start, end int64, o operation, buf []byte) (int64, error) {

Callers

nothing calls this directly

Calls 4

LogMethod · 0.95
originRequestMethod · 0.95
fstatRemoteMethod · 0.95

Tested by

no test coverage detected