2020-09-21 14:31:31 +00:00
|
|
|
package putsvc
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"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"
|
2024-08-30 09:09:14 +00:00
|
|
|
objectwriter "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/writer"
|
2023-03-07 13:38:26 +00:00
|
|
|
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"
|
2020-11-23 11:22:32 +00:00
|
|
|
"go.uber.org/zap"
|
2020-09-21 14:31:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Service struct {
|
2024-08-30 09:09:14 +00:00
|
|
|
*objectwriter.Config
|
2020-09-21 14:31:31 +00:00
|
|
|
}
|
|
|
|
|
2023-07-06 09:21:03 +00:00
|
|
|
func NewService(ks *objutil.KeyStorage,
|
2024-08-30 09:09:14 +00:00
|
|
|
cc objectwriter.ClientConstructor,
|
|
|
|
ms objectwriter.MaxSizeSource,
|
|
|
|
os objectwriter.ObjectStorage,
|
2023-07-06 09:21:03 +00:00
|
|
|
cs container.Source,
|
|
|
|
ns netmap.Source,
|
|
|
|
nk netmap.AnnouncedKeys,
|
|
|
|
nst netmap.State,
|
2024-08-30 09:09:14 +00:00
|
|
|
ir objectwriter.InnerRing,
|
|
|
|
opts ...objectwriter.Option,
|
2023-10-31 11:56:55 +00:00
|
|
|
) *Service {
|
2024-08-30 09:09:14 +00:00
|
|
|
c := &objectwriter.Config{
|
|
|
|
RemotePool: util.NewPseudoWorkerPool(),
|
|
|
|
LocalPool: util.NewPseudoWorkerPool(),
|
|
|
|
Logger: &logger.Logger{Logger: zap.L()},
|
|
|
|
KeyStorage: ks,
|
|
|
|
ClientConstructor: cc,
|
|
|
|
MaxSizeSrc: ms,
|
|
|
|
LocalStore: os,
|
|
|
|
ContainerSource: cs,
|
|
|
|
NetmapSource: ns,
|
|
|
|
NetmapKeys: nk,
|
|
|
|
NetworkState: nst,
|
2020-09-21 14:31:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for i := range opts {
|
|
|
|
opts[i](c)
|
|
|
|
}
|
|
|
|
|
2024-08-30 09:09:14 +00:00
|
|
|
c.FormatValidator = object.NewFormatValidator(
|
2023-07-28 12:44:35 +00:00
|
|
|
object.WithLockSource(os),
|
|
|
|
object.WithNetState(nst),
|
|
|
|
object.WithInnerRing(ir),
|
|
|
|
object.WithNetmapSource(ns),
|
|
|
|
object.WithContainersSource(cs),
|
2024-08-30 09:09:14 +00:00
|
|
|
object.WithVerifySessionTokenIssuer(c.VerifySessionTokenIssuer),
|
|
|
|
object.WithLogger(c.Logger),
|
2023-07-28 12:44:35 +00:00
|
|
|
)
|
2020-10-03 10:14:09 +00:00
|
|
|
|
2020-09-21 14:31:31 +00:00
|
|
|
return &Service{
|
2024-08-30 09:09:14 +00:00
|
|
|
Config: c,
|
2020-09-21 14:31:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-03 11:23:53 +00:00
|
|
|
func (p *Service) Put() (*Streamer, error) {
|
2020-09-21 14:31:31 +00:00
|
|
|
return &Streamer{
|
2024-08-30 09:09:14 +00:00
|
|
|
Config: p.Config,
|
2020-09-21 14:31:31 +00:00
|
|
|
}, nil
|
|
|
|
}
|