MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / ContainsRange

Method ContainsRange

internal/caches/reader_partial_file.go:117–129  ·  view source on GitHub ↗

ContainsRange 是否包含某些区间内容 这里的 r 是已经经过格式化的

(r rangeutils.Range)

Source from the content-addressed store, hash-verified

115// ContainsRange 是否包含某些区间内容
116// 这里的 r 是已经经过格式化的
117func (this *PartialFileReader) ContainsRange(r rangeutils.Range) (r2 rangeutils.Range, ok bool) {
118 r2, ok = this.ranges.Nearest(r.Start(), r.End())
119 if ok && this.bodySize > 0 {
120 // 考虑可配置
121 const minSpan = 128 << 10
122
123 // 这里限制返回的最小缓存,防止因为返回的内容过小而导致请求过多
124 if r2.Length() < r.Length() && r2.Length() < minSpan {
125 ok = false
126 }
127 }
128 return
129}
130
131// MaxLength 获取区间最大长度
132func (this *PartialFileReader) MaxLength() int64 {

Callers

nothing calls this directly

Calls 4

NearestMethod · 0.80
StartMethod · 0.65
EndMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected