aboutsummaryrefslogtreecommitdiff
path: root/format/packfile/ingest/fill.go
diff options
context:
space:
mode:
Diffstat (limited to 'format/packfile/ingest/fill.go')
-rw-r--r--format/packfile/ingest/fill.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/format/packfile/ingest/fill.go b/format/packfile/ingest/fill.go
deleted file mode 100644
index eca4e4d6..00000000
--- a/format/packfile/ingest/fill.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package ingest
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-// fill ensures at least min unread bytes are available in receiver's buffer.
-func (scanner *streamScanner) fill(minLen int) error {
- if minLen <= 0 {
- return nil
- }
-
- if minLen > len(scanner.buf) {
- return fmt.Errorf("packfile/ingest: fill(%d) exceeds scanner buffer", minLen)
- }
-
- for scanner.n-scanner.off < minLen {
- err := scanner.flushConsumedPrefix()
- if err != nil {
- return err
- }
-
- readN, err := scanner.src.Read(scanner.buf[scanner.n:])
- if readN > 0 {
- scanner.n += readN
- }
-
- if err != nil {
- if errors.Is(err, io.EOF) && scanner.n-scanner.off >= minLen {
- return nil
- }
-
- return err
- }
-
- if readN == 0 {
- return io.ErrNoProgress
- }
- }
-
- return nil
-}