[#1480] objsvc: Remove useless stream wrappers

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-11-08 10:10:06 +03:00 committed by Evgenii Stratonikov
parent f666898e5d
commit c82c753e9f

View file

@ -41,18 +41,6 @@ type patchStreamBasicChecker struct {
nonFirstSend bool nonFirstSend bool
} }
type getStreamBasicChecker struct {
object.GetObjectStream
}
type rangeStreamBasicChecker struct {
object.GetObjectRangeStream
}
type searchStreamBasicChecker struct {
object.SearchStream
}
// Option represents Service constructor option. // Option represents Service constructor option.
type Option func(*cfg) type Option func(*cfg)
@ -212,9 +200,7 @@ func (b Service) Get(request *objectV2.GetRequest, stream object.GetObjectStream
reqInfo.obj = obj reqInfo.obj = obj
return b.next.Get(request, &getStreamBasicChecker{ return b.next.Get(request, newWrappedGetObjectStreamStream(stream, reqInfo))
GetObjectStream: newWrappedGetObjectStreamStream(stream, reqInfo),
})
} }
func (b Service) Put() (object.PutObjectStream, error) { func (b Service) Put() (object.PutObjectStream, error) {
@ -318,9 +304,7 @@ func (b Service) Search(request *objectV2.SearchRequest, stream object.SearchStr
return err return err
} }
return b.next.Search(request, &searchStreamBasicChecker{ return b.next.Search(request, newWrappedSearchStream(stream, reqInfo))
SearchStream: newWrappedSearchStream(stream, reqInfo),
})
} }
func (b Service) Delete( func (b Service) Delete(
@ -413,9 +397,7 @@ func (b Service) GetRange(request *objectV2.GetRangeRequest, stream object.GetOb
reqInfo.obj = obj reqInfo.obj = obj
return b.next.GetRange(request, &rangeStreamBasicChecker{ return b.next.GetRange(request, newWrappedRangeStream(stream, reqInfo))
GetObjectRangeStream: newWrappedRangeStream(stream, reqInfo),
})
} }
func requestContext(ctx context.Context, reqInfo RequestInfo) context.Context { func requestContext(ctx context.Context, reqInfo RequestInfo) context.Context {
@ -627,18 +609,6 @@ func (p putStreamBasicChecker) CloseAndRecv(ctx context.Context) (*objectV2.PutR
return p.next.CloseAndRecv(ctx) return p.next.CloseAndRecv(ctx)
} }
func (g *getStreamBasicChecker) Send(resp *objectV2.GetResponse) error {
return g.GetObjectStream.Send(resp)
}
func (g *rangeStreamBasicChecker) Send(resp *objectV2.GetRangeResponse) error {
return g.GetObjectRangeStream.Send(resp)
}
func (g *searchStreamBasicChecker) Send(resp *objectV2.SearchResponse) error {
return g.SearchStream.Send(resp)
}
func (p *patchStreamBasicChecker) Send(ctx context.Context, request *objectV2.PatchRequest) error { func (p *patchStreamBasicChecker) Send(ctx context.Context, request *objectV2.PatchRequest) error {
body := request.GetBody() body := request.GetBody()
if body == nil { if body == nil {