]> Sergey Matveev's repositories - btrtrc.git/blobdiff - segments/segments.go
Misc improvements
[btrtrc.git] / segments / segments.go
index 90e77ce0d7eb21d98cc4300f5fcfdde856971c29..3870042589446957782e141c958b6aaad7fb0ada 100644 (file)
@@ -4,16 +4,6 @@ type Int = int64
 
 type Length = Int
 
-func min(i Int, rest ...Int) Int {
-       ret := i
-       for _, i := range rest {
-               if i < ret {
-                       ret = i
-               }
-       }
-       return ret
-}
-
 type Extent struct {
        Start, Length Int
 }
@@ -23,10 +13,12 @@ func (e Extent) End() Int {
 }
 
 type (
-       Callback   = func(int, Extent) bool
+       Callback   = func(segmentIndex int, segmentBounds Extent) bool
        LengthIter = func() (Length, bool)
 )
 
+// Returns true if callback returns false early, or all segments in the haystack for the needle are
+// found.
 func Scan(haystack LengthIter, needle Extent, callback Callback) bool {
        i := 0
        for needle.Length != 0 {