[#168] node: Refactor container services

Resolve containedctx for remoteLoadAnnounceWriter struct

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-24 11:08:45 +03:00
parent 28dc9e2190
commit 56161d39b4
6 changed files with 12 additions and 16 deletions

View file

@ -309,7 +309,7 @@ func (w *morphLoadWriter) Put(a containerSDK.SizeEstimation) error {
return w.cnrMorphClient.AnnounceLoad(prm)
}
func (*morphLoadWriter) Close() error {
func (*morphLoadWriter) Close(context.Context) error {
return nil
}
@ -319,7 +319,7 @@ func (nopLoadWriter) Put(containerSDK.SizeEstimation) error {
return nil
}
func (nopLoadWriter) Close() error {
func (nopLoadWriter) Close(context.Context) error {
return nil
}
@ -368,15 +368,11 @@ type remoteLoadAnnounceWriterProvider struct {
func (p *remoteLoadAnnounceWriterProvider) InitWriter(ctx context.Context) (loadcontroller.Writer, error) {
return &remoteLoadAnnounceWriter{
ctx: ctx,
client: p.client,
}, nil
}
// nolint: containedctx
type remoteLoadAnnounceWriter struct {
ctx context.Context
client client.Client
buf []containerSDK.SizeEstimation
@ -388,12 +384,12 @@ func (r *remoteLoadAnnounceWriter) Put(a containerSDK.SizeEstimation) error {
return nil
}
func (r *remoteLoadAnnounceWriter) Close() error {
func (r *remoteLoadAnnounceWriter) Close(ctx context.Context) error {
var cliPrm apiClient.PrmAnnounceSpace
cliPrm.SetValues(r.buf)
_, err := r.client.ContainerAnnounceUsedSpace(r.ctx, cliPrm)
_, err := r.client.ContainerAnnounceUsedSpace(ctx, cliPrm)
return err
}