Skip to content

Commit

Permalink
pool: Remove elapsedTimeCallback
Browse files Browse the repository at this point in the history
Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Jun 30, 2023
1 parent 58255ed commit 5d58fba
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1905,19 +1905,12 @@ func (p *Pool) RawClient() (*sdkClient.Client, error) {
}

type objectReadCloser struct {
reader *sdkClient.ObjectReader
elapsedTimeCallback func(time.Duration)
reader *sdkClient.ObjectReader
}

// Read implements io.Reader of the object payload.
func (x *objectReadCloser) Read(p []byte) (int, error) {
start := time.Now()
n, err := x.reader.Read(p)
if x.elapsedTimeCallback != nil {
x.elapsedTimeCallback(time.Since(start))
}

return n, err
return x.reader.Read(p)
}

// Close implements io.Closer of the object payload.
Expand Down Expand Up @@ -1987,19 +1980,12 @@ func (p *Pool) HeadObject(ctx context.Context, containerID cid.ID, objectID oid.
// Must be initialized using Pool.ObjectRange, any other
// usage is unsafe.
type ResObjectRange struct {
payload *sdkClient.ObjectRangeReader
elapsedTimeCallback func(time.Duration)
payload *sdkClient.ObjectRangeReader
}

// Read implements io.Reader of the object payload.
func (x *ResObjectRange) Read(p []byte) (int, error) {
start := time.Now()
n, err := x.payload.Read(p)
if x.elapsedTimeCallback != nil {
x.elapsedTimeCallback(time.Since(start))
}

return n, err
return x.payload.Read(p)
}

// Close ends reading the payload range and returns the result of the operation
Expand Down

0 comments on commit 5d58fba

Please sign in to comment.