forked from TrueCloudLab/frostfs-node
[#1310] object: Move target initialization to separate package
* Split the logic of write target initialization to different packages; * Refactor patch and put services: since both service initialize the target themselves. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
7768a482b5
commit
b3deb893ba
22 changed files with 599 additions and 585 deletions
23
pkg/services/object/common/writer/dispatcher.go
Normal file
23
pkg/services/object/common/writer/dispatcher.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package writer
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
|
||||
)
|
||||
|
||||
var _ transformer.ObjectWriter = (*objectWriterDispatcher)(nil)
|
||||
|
||||
type objectWriterDispatcher struct {
|
||||
ecWriter transformer.ObjectWriter
|
||||
repWriter transformer.ObjectWriter
|
||||
}
|
||||
|
||||
func (m *objectWriterDispatcher) WriteObject(ctx context.Context, obj *objectSDK.Object) error {
|
||||
if object.IsECSupported(obj) {
|
||||
return m.ecWriter.WriteObject(ctx, obj)
|
||||
}
|
||||
return m.repWriter.WriteObject(ctx, obj)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue