frostfs-node/pkg/services/object/put/service.go
Dmitrii Stepanov 6db46257c0
[] node: Use ctx for logging
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-11-13 10:36:07 +03:00

66 lines
1.7 KiB
Go

package putsvc
import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
objectwriter "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/writer"
objutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"go.uber.org/zap"
)
type Service struct {
*objectwriter.Config
}
func NewService(ks *objutil.KeyStorage,
cc objectwriter.ClientConstructor,
ms objectwriter.MaxSizeSource,
os objectwriter.ObjectStorage,
cs container.Source,
ns netmap.Source,
nk netmap.AnnouncedKeys,
nst netmap.State,
ir objectwriter.InnerRing,
opts ...objectwriter.Option,
) *Service {
c := &objectwriter.Config{
RemotePool: util.NewPseudoWorkerPool(),
LocalPool: util.NewPseudoWorkerPool(),
Logger: logger.NewLoggerWrapper(zap.L()),
KeyStorage: ks,
ClientConstructor: cc,
MaxSizeSrc: ms,
LocalStore: os,
ContainerSource: cs,
NetmapSource: ns,
NetmapKeys: nk,
NetworkState: nst,
}
for i := range opts {
opts[i](c)
}
c.FormatValidator = object.NewFormatValidator(
object.WithLockSource(os),
object.WithNetState(nst),
object.WithInnerRing(ir),
object.WithNetmapSource(ns),
object.WithContainersSource(cs),
object.WithVerifySessionTokenIssuer(c.VerifySessionTokenIssuer),
object.WithLogger(c.Logger),
)
return &Service{
Config: c,
}
}
func (p *Service) Put() (*Streamer, error) {
return &Streamer{
Config: p.Config,
}, nil
}