MCPcopy
hub / github.com/perkeep/perkeep / Less

Method Less

pkg/blob/ref.go:818–829  ·  view source on GitHub ↗

Less reports whether r sorts before o. Invalid references blobs sort first.

(o Ref)

Source from the content-addressed store, hash-verified

816
817// Less reports whether r sorts before o. Invalid references blobs sort first.
818func (r Ref) Less(o Ref) bool {
819 if r.Valid() != o.Valid() {
820 return o.Valid()
821 }
822 if !r.Valid() {
823 return false
824 }
825 if n1, n2 := r.digest.digestName(), o.digest.digestName(); n1 != n2 {
826 return n1 < n2
827 }
828 return bytes.Compare(r.digest.bytes(), o.digest.bytes()) < 0
829}
830
831// ByRef sorts blob references.
832type ByRef []Ref

Callers 4

StreamBlobsMethod · 0.95
LessMethod · 0.45
LessMethod · 0.45
LessMethod · 0.45

Calls 3

ValidMethod · 0.95
digestNameMethod · 0.65
bytesMethod · 0.65

Tested by

no test coverage detected