Welcome to mirror list, hosted at ThFree Co, Russian Federation.

reader.go « filestore « internal « workhorse - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b1045b991fc06cb3b04745094c25b04cc2ae5263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package filestore

import "io"

type hardLimitReader struct {
	r io.Reader
	n int64
}

func (h *hardLimitReader) Read(p []byte) (int, error) {
	nRead, err := h.r.Read(p)
	h.n -= int64(nRead)
	if h.n < 0 {
		err = ErrEntityTooLarge
	}
	return nRead, err
}