aboutsummaryrefslogtreecommitdiff
path: root/object/store/packed/internal/ingest/counting_writer.go
blob: 051ad9d1d40f1be409863b2966097cb6be9d939d (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package ingest

import "io"

// countingWriter counts bytes written to dst.
type countingWriter struct {
	dst io.Writer
	n   int
}

// Write writes src to dst and tracks output byte count.
func (writer *countingWriter) Write(src []byte) (int, error) {
	n, err := writer.dst.Write(src)
	writer.n += n

	return n, err
}