All checks were successful
DCO action / DCO (pull_request) Successful in 5m1s
Tests and linters / Run gofumpt (pull_request) Successful in 5m31s
Pre-commit hooks / Pre-commit (pull_request) Successful in 5m54s
Vulncheck / Vulncheck (pull_request) Successful in 5m39s
Build / Build Components (1.22) (pull_request) Successful in 6m6s
Build / Build Components (1.23) (pull_request) Successful in 6m7s
Tests and linters / Tests (1.22) (pull_request) Successful in 6m0s
Tests and linters / Tests (1.23) (pull_request) Successful in 6m9s
Tests and linters / Staticcheck (pull_request) Successful in 6m9s
Tests and linters / Lint (pull_request) Successful in 6m19s
Tests and linters / Tests with -race (pull_request) Successful in 6m33s
Tests and linters / gopls check (pull_request) Successful in 6m46s
* 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>
23 lines
629 B
Go
23 lines
629 B
Go
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)
|
|
}
|