frostfs-node/pkg/services/object/patch/service.go
Alexander Chuprov 6f7b6b65f3 [#1689] linter: Fix staticcheck warning: 'embedded field can be simplified'
Change-Id: I8f454f7d09973cdea096495c3949b88cdd01102e
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2025-04-08 09:32:24 +00:00

41 lines
998 B
Go

package patchsvc
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
objectwriter "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/writer"
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
)
// Service implements Put operation of Object service v2.
type Service struct {
*objectwriter.Config
getSvc *getsvc.Service
}
// NewService constructs Service instance from provided options.
//
// Patch service can use the same objectwriter.Config initializied by Put service.
func NewService(cfg *objectwriter.Config,
getSvc *getsvc.Service,
) *Service {
return &Service{
Config: cfg,
getSvc: getSvc,
}
}
// Patch calls internal service and returns v2 object streamer.
func (s *Service) Patch() (object.PatchObjectStream, error) {
nodeKey, err := s.KeyStorage.GetKey(nil)
if err != nil {
return nil, err
}
return &Streamer{
Config: s.Config,
getSvc: s.getSvc,
localNodeKey: nodeKey,
}, nil
}