All checks were successful
Tests and linters / Run gofumpt (pull_request) Successful in 30s
DCO action / DCO (pull_request) Successful in 58s
Vulncheck / Vulncheck (pull_request) Successful in 1m35s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m46s
Build / Build Components (pull_request) Successful in 1m56s
Tests and linters / gopls check (pull_request) Successful in 2m19s
Tests and linters / Staticcheck (pull_request) Successful in 2m39s
Tests and linters / Tests (pull_request) Successful in 3m17s
Tests and linters / Tests with -race (pull_request) Successful in 3m23s
Tests and linters / Lint (pull_request) Successful in 3m36s
* 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)
|
|
}
|