2024-08-30 09:09:14 +00:00
|
|
|
package writer
|
2024-03-28 10:46:19 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|