aboutsummaryrefslogtreecommitdiff
path: root/format
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-28 19:58:37 +0000
committerGravatar Runxi Yu2026-03-28 19:58:37 +0000
commitea8373ed78113af57315ae4523d42dfed3a3b1fe (patch)
tree835f98905046a8e5564cf6057af450fe03035444 /format
parentcommon/iowrap: Add io wrappers (diff)
signatureNo signature
network, internal/progress, format/packfile/ingest: Use WriteFlusher
Diffstat (limited to 'format')
-rw-r--r--format/packfile/ingest/api.go7
-rw-r--r--format/packfile/ingest/idx_write.go4
-rw-r--r--format/packfile/ingest/progress_write.go4
-rw-r--r--format/packfile/ingest/resolve_all.go1
-rw-r--r--format/packfile/ingest/rev_write.go1
-rw-r--r--format/packfile/ingest/scan.go1
-rw-r--r--format/packfile/ingest/thin_fix.go1
7 files changed, 4 insertions, 15 deletions
diff --git a/format/packfile/ingest/api.go b/format/packfile/ingest/api.go
index 5d999d61..ad04fe14 100644
--- a/format/packfile/ingest/api.go
+++ b/format/packfile/ingest/api.go
@@ -7,6 +7,7 @@ import (
"io"
"os"
+ "codeberg.org/lindenii/furgit/common/iowrap"
objectid "codeberg.org/lindenii/furgit/object/id"
objectstore "codeberg.org/lindenii/furgit/object/store"
)
@@ -22,11 +23,7 @@ type Options struct {
// Progress receives human-readable progress messages.
//
// When nil, no progress output is emitted.
- Progress io.Writer
- // ProgressFlush flushes transport output after progress writes.
- //
- // When nil, no explicit flush is attempted.
- ProgressFlush func() error
+ Progress iowrap.WriteFlusher
// RequireTrailingEOF requires the source to hit EOF after the pack trailer.
//
// This is suitable for exact pack-file readers, but should be disabled for
diff --git a/format/packfile/ingest/idx_write.go b/format/packfile/ingest/idx_write.go
index 506788b9..fa139264 100644
--- a/format/packfile/ingest/idx_write.go
+++ b/format/packfile/ingest/idx_write.go
@@ -83,7 +83,6 @@ func writeIdx(state *ingestState) error {
oidMeter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "writing index object ids",
Total: uint64(len(order)),
})
@@ -108,7 +107,6 @@ func writeIdx(state *ingestState) error {
crcMeter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "writing index crc32",
Total: uint64(len(order)),
})
@@ -134,7 +132,6 @@ func writeIdx(state *ingestState) error {
largeOffsets := make([]uint64, 0)
offsetMeter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "writing index offsets",
Total: uint64(len(order)),
})
@@ -178,7 +175,6 @@ func writeIdx(state *ingestState) error {
largeOffsetMeter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "writing index large offsets",
Total: total,
})
diff --git a/format/packfile/ingest/progress_write.go b/format/packfile/ingest/progress_write.go
index 5b9f184b..afb39305 100644
--- a/format/packfile/ingest/progress_write.go
+++ b/format/packfile/ingest/progress_write.go
@@ -5,7 +5,7 @@ import "codeberg.org/lindenii/furgit/internal/utils"
func writeProgressf(state *ingestState, format string, args ...any) {
utils.BestEffortFprintf(state.opts.Progress, format, args...)
- if state.opts.ProgressFlush != nil {
- _ = state.opts.ProgressFlush()
+ if state.opts.Progress != nil {
+ _ = state.opts.Progress.Flush()
}
}
diff --git a/format/packfile/ingest/resolve_all.go b/format/packfile/ingest/resolve_all.go
index e0ad2281..90464015 100644
--- a/format/packfile/ingest/resolve_all.go
+++ b/format/packfile/ingest/resolve_all.go
@@ -26,7 +26,6 @@ func resolveAll(state *ingestState) error {
meter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "resolving deltas",
Total: uint64(pending),
})
diff --git a/format/packfile/ingest/rev_write.go b/format/packfile/ingest/rev_write.go
index f8c30c1b..16d27085 100644
--- a/format/packfile/ingest/rev_write.go
+++ b/format/packfile/ingest/rev_write.go
@@ -61,7 +61,6 @@ func writeRev(state *ingestState) error {
entriesMeter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "writing reverse index entries",
Total: uint64(len(packOrder)),
})
diff --git a/format/packfile/ingest/scan.go b/format/packfile/ingest/scan.go
index de4e993c..ddd1eaf3 100644
--- a/format/packfile/ingest/scan.go
+++ b/format/packfile/ingest/scan.go
@@ -37,7 +37,6 @@ func streamPackAndScan(state *ingestState) error {
total := state.objectCountHeader
meter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "receiving objects",
Total: uint64(total),
Throughput: true,
diff --git a/format/packfile/ingest/thin_fix.go b/format/packfile/ingest/thin_fix.go
index 3dad1354..f66ed279 100644
--- a/format/packfile/ingest/thin_fix.go
+++ b/format/packfile/ingest/thin_fix.go
@@ -60,7 +60,6 @@ func maybeFixThin(state *ingestState) error {
total := len(baseIDs)
meter := progress.New(progress.Options{
Writer: state.opts.Progress,
- Flush: state.opts.ProgressFlush,
Title: "fixing thin pack",
Total: uint64(total),
})