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