frostfs-node/pkg/services/object/patch/service.go
Alexander Chuprov d83879d4b8 [#1431] node: Fix comment format
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2024-10-15 08:53:59 +00:00

41 lines
1,005 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.Config.KeyStorage.GetKey(nil)
if err != nil {
return nil, err
}
return &Streamer{
Config: s.Config,
getSvc: s.getSvc,
localNodeKey: nodeKey,
}, nil
}