[#1338] object: Fix range provider in Patch
handler
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m50s
DCO action / DCO (pull_request) Successful in 1m54s
Vulncheck / Vulncheck (pull_request) Successful in 2m29s
Tests and linters / Tests (1.23) (pull_request) Successful in 2m58s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m59s
Tests and linters / Lint (pull_request) Successful in 3m17s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m3s
Build / Build Components (1.23) (pull_request) Successful in 3m12s
Build / Build Components (1.22) (pull_request) Successful in 3m15s
Tests and linters / Staticcheck (pull_request) Successful in 3m35s
Tests and linters / gopls check (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 4m11s
All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 1m50s
DCO action / DCO (pull_request) Successful in 1m54s
Vulncheck / Vulncheck (pull_request) Successful in 2m29s
Tests and linters / Tests (1.23) (pull_request) Successful in 2m58s
Tests and linters / Tests (1.22) (pull_request) Successful in 2m59s
Tests and linters / Lint (pull_request) Successful in 3m17s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m3s
Build / Build Components (1.23) (pull_request) Successful in 3m12s
Build / Build Components (1.22) (pull_request) Successful in 3m15s
Tests and linters / Staticcheck (pull_request) Successful in 3m35s
Tests and linters / gopls check (pull_request) Successful in 3m52s
Tests and linters / Tests with -race (pull_request) Successful in 4m11s
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
d6b42972a8
commit
6488ddee88
1 changed files with 12 additions and 0 deletions
|
@ -30,6 +30,12 @@ type rangeProvider struct {
|
||||||
var _ patcherSDK.RangeProvider = (*rangeProvider)(nil)
|
var _ patcherSDK.RangeProvider = (*rangeProvider)(nil)
|
||||||
|
|
||||||
func (r *rangeProvider) GetRange(ctx context.Context, rng *objectSDK.Range) io.Reader {
|
func (r *rangeProvider) GetRange(ctx context.Context, rng *objectSDK.Range) io.Reader {
|
||||||
|
// Remote GetRange request to a container node uses an SDK-client that fails range validation
|
||||||
|
// with zero-length. However, from the patcher's point of view, such request is still valid.
|
||||||
|
if rng.GetLength() == 0 {
|
||||||
|
return &nopReader{}
|
||||||
|
}
|
||||||
|
|
||||||
pipeReader, pipeWriter := io.Pipe()
|
pipeReader, pipeWriter := io.Pipe()
|
||||||
|
|
||||||
var rngPrm getsvc.RangePrm
|
var rngPrm getsvc.RangePrm
|
||||||
|
@ -61,3 +67,9 @@ func (r *rangeProvider) GetRange(ctx context.Context, rng *objectSDK.Range) io.R
|
||||||
|
|
||||||
return pipeReader
|
return pipeReader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type nopReader struct{}
|
||||||
|
|
||||||
|
func (nopReader) Read(_ []byte) (int, error) {
|
||||||
|
return 0, io.EOF
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue