[#496] node: Fix linter importas
All checks were successful
Build / Build Components (1.20) (pull_request) Successful in 3m52s
Build / Build Components (1.19) (pull_request) Successful in 4m1s
ci/woodpecker/pr/pre-commit Pipeline was successful
Tests and linters / Tests with -race (pull_request) Successful in 5m36s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m55s
Tests and linters / Lint (pull_request) Successful in 14m40s
Tests and linters / Tests (1.19) (pull_request) Successful in 15m29s
ci/woodpecker/push/pre-commit Pipeline was successful

Standardize the alias of the
import frostfs-sdk-go/object as objectSDK.

Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
Alexander Chuprov 2023-07-06 15:36:41 +03:00
parent 4bbe9cc936
commit 033eaf77e1
80 changed files with 444 additions and 443 deletions

View file

@ -13,7 +13,7 @@ import (
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
) )
@ -331,17 +331,17 @@ type PutObjectPrm struct {
copyNum []uint32 copyNum []uint32
hdr *object.Object hdr *objectSDK.Object
rdr io.Reader rdr io.Reader
headerCallback func(*object.Object) headerCallback func(*objectSDK.Object)
prepareLocally bool prepareLocally bool
} }
// SetHeader sets object header. // SetHeader sets object header.
func (x *PutObjectPrm) SetHeader(hdr *object.Object) { func (x *PutObjectPrm) SetHeader(hdr *objectSDK.Object) {
x.hdr = hdr x.hdr = hdr
} }
@ -352,7 +352,7 @@ func (x *PutObjectPrm) SetPayloadReader(rdr io.Reader) {
// SetHeaderCallback sets callback which is called on the object after the header is received // SetHeaderCallback sets callback which is called on the object after the header is received
// but before the payload is written. // but before the payload is written.
func (x *PutObjectPrm) SetHeaderCallback(f func(*object.Object)) { func (x *PutObjectPrm) SetHeaderCallback(f func(*objectSDK.Object)) {
x.headerCallback = f x.headerCallback = f
} }
@ -532,22 +532,22 @@ type GetObjectPrm struct {
objectAddressPrm objectAddressPrm
rawPrm rawPrm
payloadWriterPrm payloadWriterPrm
headerCallback func(*object.Object) headerCallback func(*objectSDK.Object)
} }
// SetHeaderCallback sets callback which is called on the object after the header is received // SetHeaderCallback sets callback which is called on the object after the header is received
// but before the payload is written. // but before the payload is written.
func (p *GetObjectPrm) SetHeaderCallback(f func(*object.Object)) { func (p *GetObjectPrm) SetHeaderCallback(f func(*objectSDK.Object)) {
p.headerCallback = f p.headerCallback = f
} }
// GetObjectRes groups the resulting values of GetObject operation. // GetObjectRes groups the resulting values of GetObject operation.
type GetObjectRes struct { type GetObjectRes struct {
hdr *object.Object hdr *objectSDK.Object
} }
// Header returns the header of the request object. // Header returns the header of the request object.
func (x GetObjectRes) Header() *object.Object { func (x GetObjectRes) Header() *objectSDK.Object {
return x.hdr return x.hdr
} }
@ -585,7 +585,7 @@ func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
return nil, fmt.Errorf("init object reading on client: %w", err) return nil, fmt.Errorf("init object reading on client: %w", err)
} }
var hdr object.Object var hdr objectSDK.Object
if !rdr.ReadHeader(&hdr) { if !rdr.ReadHeader(&hdr) {
_, err = rdr.Close() _, err = rdr.Close()
@ -621,11 +621,11 @@ func (x *HeadObjectPrm) SetMainOnlyFlag(v bool) {
// HeadObjectRes groups the resulting values of HeadObject operation. // HeadObjectRes groups the resulting values of HeadObject operation.
type HeadObjectRes struct { type HeadObjectRes struct {
hdr *object.Object hdr *objectSDK.Object
} }
// Header returns the requested object header. // Header returns the requested object header.
func (x HeadObjectRes) Header() *object.Object { func (x HeadObjectRes) Header() *objectSDK.Object {
return x.hdr return x.hdr
} }
@ -661,7 +661,7 @@ func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error)
return nil, fmt.Errorf("read object header via client: %w", err) return nil, fmt.Errorf("read object header via client: %w", err)
} }
var hdr object.Object var hdr objectSDK.Object
if !res.ReadHeader(&hdr) { if !res.ReadHeader(&hdr) {
return nil, fmt.Errorf("missing header in response") return nil, fmt.Errorf("missing header in response")
@ -677,11 +677,11 @@ type SearchObjectsPrm struct {
commonObjectPrm commonObjectPrm
containerIDPrm containerIDPrm
filters object.SearchFilters filters objectSDK.SearchFilters
} }
// SetFilters sets search filters. // SetFilters sets search filters.
func (x *SearchObjectsPrm) SetFilters(filters object.SearchFilters) { func (x *SearchObjectsPrm) SetFilters(filters objectSDK.SearchFilters) {
x.filters = filters x.filters = filters
} }
@ -754,7 +754,7 @@ type HashPayloadRangesPrm struct {
tz bool tz bool
rngs []*object.Range rngs []*objectSDK.Range
salt []byte salt []byte
} }
@ -765,7 +765,7 @@ func (x *HashPayloadRangesPrm) TZ() {
} }
// SetRanges sets a list of payload ranges to hash. // SetRanges sets a list of payload ranges to hash.
func (x *HashPayloadRangesPrm) SetRanges(rngs []*object.Range) { func (x *HashPayloadRangesPrm) SetRanges(rngs []*objectSDK.Range) {
x.rngs = rngs x.rngs = rngs
} }
@ -839,11 +839,11 @@ type PayloadRangePrm struct {
rawPrm rawPrm
payloadWriterPrm payloadWriterPrm
rng *object.Range rng *objectSDK.Range
} }
// SetRange sets payload range to read. // SetRange sets payload range to read.
func (x *PayloadRangePrm) SetRange(rng *object.Range) { func (x *PayloadRangePrm) SetRange(rng *objectSDK.Range) {
x.rng = rng x.rng = rng
} }

View file

@ -9,7 +9,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
objectCli "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/modules/object" objectCli "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/modules/object"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -31,7 +31,7 @@ var listContainerObjectsCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
id := parseContainerID(cmd) id := parseContainerID(cmd)
filters := new(object.SearchFilters) filters := new(objectSDK.SearchFilters)
filters.AddRootFilter() // search only user created objects filters.AddRootFilter() // search only user created objects
cli := internalclient.GetSDKClientByFlag(cmd, key.GetOrGenerate(cmd), commonflags.RPC) cli := internalclient.GetSDKClientByFlag(cmd, key.GetOrGenerate(cmd), commonflags.RPC)

View file

@ -11,7 +11,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/cheggaaa/pb" "github.com/cheggaaa/pb"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -84,7 +84,7 @@ func getObject(cmd *cobra.Command, _ []string) {
p = pb.New64(0) p = pb.New64(0)
p.Output = cmd.OutOrStdout() p.Output = cmd.OutOrStdout()
prm.SetPayloadWriter(p.NewProxyWriter(payloadWriter)) prm.SetPayloadWriter(p.NewProxyWriter(payloadWriter))
prm.SetHeaderCallback(func(o *object.Object) { prm.SetHeaderCallback(func(o *objectSDK.Object) {
p.SetTotal64(int64(o.PayloadSize())) p.SetTotal64(int64(o.PayloadSize()))
p.Start() p.Start()
}) })

View file

@ -13,7 +13,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -77,7 +77,7 @@ func getObjectHeader(cmd *cobra.Command, _ []string) {
commonCmd.ExitOnErr(cmd, "", err) commonCmd.ExitOnErr(cmd, "", err)
} }
func saveAndPrintHeader(cmd *cobra.Command, obj *object.Object, filename string) error { func saveAndPrintHeader(cmd *cobra.Command, obj *objectSDK.Object, filename string) error {
bs, err := marshalHeader(cmd, obj) bs, err := marshalHeader(cmd, obj)
if err != nil { if err != nil {
return fmt.Errorf("could not marshal header: %w", err) return fmt.Errorf("could not marshal header: %w", err)
@ -97,7 +97,7 @@ func saveAndPrintHeader(cmd *cobra.Command, obj *object.Object, filename string)
return printHeader(cmd, obj) return printHeader(cmd, obj)
} }
func marshalHeader(cmd *cobra.Command, hdr *object.Object) ([]byte, error) { func marshalHeader(cmd *cobra.Command, hdr *objectSDK.Object) ([]byte, error) {
toJSON, _ := cmd.Flags().GetBool(commonflags.JSON) toJSON, _ := cmd.Flags().GetBool(commonflags.JSON)
toProto, _ := cmd.Flags().GetBool("proto") toProto, _ := cmd.Flags().GetBool("proto")
switch { switch {
@ -138,7 +138,7 @@ func printContainerID(cmd *cobra.Command, recv func() (cid.ID, bool)) {
cmd.Printf("CID: %s\n", strID) cmd.Printf("CID: %s\n", strID)
} }
func printHeader(cmd *cobra.Command, obj *object.Object) error { func printHeader(cmd *cobra.Command, obj *objectSDK.Object) error {
printObjectID(cmd, obj.ID) printObjectID(cmd, obj.ID)
printContainerID(cmd, obj.ContainerID) printContainerID(cmd, obj.ContainerID)
cmd.Printf("Owner: %s\n", obj.OwnerID()) cmd.Printf("Owner: %s\n", obj.OwnerID())
@ -150,7 +150,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error {
cmd.Println("Attributes:") cmd.Println("Attributes:")
for _, attr := range obj.Attributes() { for _, attr := range obj.Attributes() {
if attr.Key() == object.AttributeTimestamp { if attr.Key() == objectSDK.AttributeTimestamp {
cmd.Printf(" %s=%s (%s)\n", cmd.Printf(" %s=%s (%s)\n",
attr.Key(), attr.Key(),
attr.Value(), attr.Value(),
@ -174,7 +174,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error {
return printSplitHeader(cmd, obj) return printSplitHeader(cmd, obj)
} }
func printSplitHeader(cmd *cobra.Command, obj *object.Object) error { func printSplitHeader(cmd *cobra.Command, obj *objectSDK.Object) error {
if splitID := obj.SplitID(); splitID != nil { if splitID := obj.SplitID(); splitID != nil {
cmd.Printf("Split ID: %s\n", splitID) cmd.Printf("Split ID: %s\n", splitID)
} }

View file

@ -16,7 +16,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"github.com/cheggaaa/pb" "github.com/cheggaaa/pb"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -81,7 +81,7 @@ func putObject(cmd *cobra.Command, _ []string) {
commonCmd.ExitOnErr(cmd, "", fmt.Errorf("can't open file '%s': %w", filename, err)) commonCmd.ExitOnErr(cmd, "", fmt.Errorf("can't open file '%s': %w", filename, err))
} }
var payloadReader io.Reader = f var payloadReader io.Reader = f
obj := object.New() obj := objectSDK.New()
if binary { if binary {
payloadReader, cnr, ownerID = readFilePayload(filename, cmd) payloadReader, cnr, ownerID = readFilePayload(filename, cmd)
@ -155,7 +155,7 @@ func parseCopyNumber(cmd *cobra.Command, copyNum string) []uint32 {
func readFilePayload(filename string, cmd *cobra.Command) (io.Reader, cid.ID, user.ID) { func readFilePayload(filename string, cmd *cobra.Command) (io.Reader, cid.ID, user.ID) {
buf, err := os.ReadFile(filename) buf, err := os.ReadFile(filename)
commonCmd.ExitOnErr(cmd, "unable to read given file: %w", err) commonCmd.ExitOnErr(cmd, "unable to read given file: %w", err)
objTemp := object.New() objTemp := objectSDK.New()
// TODO(@acid-ant): #1932 Use streams to marshal/unmarshal payload // TODO(@acid-ant): #1932 Use streams to marshal/unmarshal payload
commonCmd.ExitOnErr(cmd, "can't unmarshal object from given file: %w", objTemp.Unmarshal(buf)) commonCmd.ExitOnErr(cmd, "can't unmarshal object from given file: %w", objTemp.Unmarshal(buf))
payloadReader := bytes.NewReader(objTemp.Payload()) payloadReader := bytes.NewReader(objTemp.Payload())
@ -174,19 +174,19 @@ func setFilePayloadReader(cmd *cobra.Command, f *os.File, prm *internalclient.Pu
p := pb.New64(fi.Size()) p := pb.New64(fi.Size())
p.Output = cmd.OutOrStdout() p.Output = cmd.OutOrStdout()
prm.SetPayloadReader(p.NewProxyReader(f)) prm.SetPayloadReader(p.NewProxyReader(f))
prm.SetHeaderCallback(func(o *object.Object) { p.Start() }) prm.SetHeaderCallback(func(o *objectSDK.Object) { p.Start() })
return p return p
} }
func setBinaryPayloadReader(cmd *cobra.Command, obj *object.Object, prm *internalclient.PutObjectPrm, payloadReader io.Reader) *pb.ProgressBar { func setBinaryPayloadReader(cmd *cobra.Command, obj *objectSDK.Object, prm *internalclient.PutObjectPrm, payloadReader io.Reader) *pb.ProgressBar {
p := pb.New(len(obj.Payload())) p := pb.New(len(obj.Payload()))
p.Output = cmd.OutOrStdout() p.Output = cmd.OutOrStdout()
prm.SetPayloadReader(p.NewProxyReader(payloadReader)) prm.SetPayloadReader(p.NewProxyReader(payloadReader))
prm.SetHeaderCallback(func(o *object.Object) { p.Start() }) prm.SetHeaderCallback(func(o *objectSDK.Object) { p.Start() })
return p return p
} }
func getAllObjectAttributes(cmd *cobra.Command) []object.Attribute { func getAllObjectAttributes(cmd *cobra.Command) []objectSDK.Attribute {
attrs, err := parseObjectAttrs(cmd) attrs, err := parseObjectAttrs(cmd)
commonCmd.ExitOnErr(cmd, "can't parse object attributes: %w", err) commonCmd.ExitOnErr(cmd, "can't parse object attributes: %w", err)
@ -205,7 +205,7 @@ func getAllObjectAttributes(cmd *cobra.Command) []object.Attribute {
if !expAttrFound { if !expAttrFound {
index := len(attrs) index := len(attrs)
attrs = append(attrs, object.Attribute{}) attrs = append(attrs, objectSDK.Attribute{})
attrs[index].SetKey(objectV2.SysAttributeExpEpoch) attrs[index].SetKey(objectV2.SysAttributeExpEpoch)
attrs[index].SetValue(expAttrValue) attrs[index].SetValue(expAttrValue)
} }
@ -213,7 +213,7 @@ func getAllObjectAttributes(cmd *cobra.Command) []object.Attribute {
return attrs return attrs
} }
func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) { func parseObjectAttrs(cmd *cobra.Command) ([]objectSDK.Attribute, error) {
var rawAttrs []string var rawAttrs []string
raw := cmd.Flag("attributes").Value.String() raw := cmd.Flag("attributes").Value.String()
@ -221,7 +221,7 @@ func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) {
rawAttrs = strings.Split(raw, ",") rawAttrs = strings.Split(raw, ",")
} }
attrs := make([]object.Attribute, len(rawAttrs), len(rawAttrs)+2) // name + timestamp attributes attrs := make([]objectSDK.Attribute, len(rawAttrs), len(rawAttrs)+2) // name + timestamp attributes
for i := range rawAttrs { for i := range rawAttrs {
k, v, found := strings.Cut(rawAttrs[i], "=") k, v, found := strings.Cut(rawAttrs[i], "=")
if !found { if !found {
@ -235,23 +235,23 @@ func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) {
if !disableFilename { if !disableFilename {
filename := filepath.Base(cmd.Flag(fileFlag).Value.String()) filename := filepath.Base(cmd.Flag(fileFlag).Value.String())
index := len(attrs) index := len(attrs)
attrs = append(attrs, object.Attribute{}) attrs = append(attrs, objectSDK.Attribute{})
attrs[index].SetKey(object.AttributeFileName) attrs[index].SetKey(objectSDK.AttributeFileName)
attrs[index].SetValue(filename) attrs[index].SetValue(filename)
} }
disableTime, _ := cmd.Flags().GetBool("disable-timestamp") disableTime, _ := cmd.Flags().GetBool("disable-timestamp")
if !disableTime { if !disableTime {
index := len(attrs) index := len(attrs)
attrs = append(attrs, object.Attribute{}) attrs = append(attrs, objectSDK.Attribute{})
attrs[index].SetKey(object.AttributeTimestamp) attrs[index].SetKey(objectSDK.AttributeTimestamp)
attrs[index].SetValue(strconv.FormatInt(time.Now().Unix(), 10)) attrs[index].SetValue(strconv.FormatInt(time.Now().Unix(), 10))
} }
return attrs, nil return attrs, nil
} }
func parseObjectNotifications(cmd *cobra.Command) (*object.NotificationInfo, error) { func parseObjectNotifications(cmd *cobra.Command) (*objectSDK.NotificationInfo, error) {
const ( const (
separator = ":" separator = ":"
useDefaultTopic = "-" useDefaultTopic = "-"
@ -267,7 +267,7 @@ func parseObjectNotifications(cmd *cobra.Command) (*object.NotificationInfo, err
return nil, fmt.Errorf("notification must be in the form of: *epoch*%s*topic*, got %s", separator, raw) return nil, fmt.Errorf("notification must be in the form of: *epoch*%s*topic*, got %s", separator, raw)
} }
ni := new(object.NotificationInfo) ni := new(objectSDK.NotificationInfo)
epoch, err := strconv.ParseUint(before, 10, 64) epoch, err := strconv.ParseUint(before, 10, 64)
if err != nil { if err != nil {

View file

@ -14,7 +14,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -102,7 +102,7 @@ func getObjectRange(cmd *cobra.Command, _ []string) {
} }
func printSplitInfoErr(cmd *cobra.Command, err error) bool { func printSplitInfoErr(cmd *cobra.Command, err error) bool {
var errSplitInfo *object.SplitInfoError var errSplitInfo *objectSDK.SplitInfoError
ok := errors.As(err, &errSplitInfo) ok := errors.As(err, &errSplitInfo)
@ -114,14 +114,14 @@ func printSplitInfoErr(cmd *cobra.Command, err error) bool {
return ok return ok
} }
func printSplitInfo(cmd *cobra.Command, info *object.SplitInfo) { func printSplitInfo(cmd *cobra.Command, info *objectSDK.SplitInfo) {
bs, err := marshalSplitInfo(cmd, info) bs, err := marshalSplitInfo(cmd, info)
commonCmd.ExitOnErr(cmd, "can't marshal split info: %w", err) commonCmd.ExitOnErr(cmd, "can't marshal split info: %w", err)
cmd.Println(string(bs)) cmd.Println(string(bs))
} }
func marshalSplitInfo(cmd *cobra.Command, info *object.SplitInfo) ([]byte, error) { func marshalSplitInfo(cmd *cobra.Command, info *objectSDK.SplitInfo) ([]byte, error) {
toJSON, _ := cmd.Flags().GetBool(commonflags.JSON) toJSON, _ := cmd.Flags().GetBool(commonflags.JSON)
toProto, _ := cmd.Flags().GetBool("proto") toProto, _ := cmd.Flags().GetBool("proto")
switch { switch {
@ -146,13 +146,13 @@ func marshalSplitInfo(cmd *cobra.Command, info *object.SplitInfo) ([]byte, error
} }
} }
func getRangeList(cmd *cobra.Command) ([]*object.Range, error) { func getRangeList(cmd *cobra.Command) ([]*objectSDK.Range, error) {
v := cmd.Flag("range").Value.String() v := cmd.Flag("range").Value.String()
if len(v) == 0 { if len(v) == 0 {
return nil, nil return nil, nil
} }
vs := strings.Split(v, ",") vs := strings.Split(v, ",")
rs := make([]*object.Range, len(vs)) rs := make([]*objectSDK.Range, len(vs))
for i := range vs { for i := range vs {
before, after, found := strings.Cut(vs[i], rangeSep) before, after, found := strings.Cut(vs[i], rangeSep)
if !found { if !found {
@ -176,7 +176,7 @@ func getRangeList(cmd *cobra.Command) ([]*object.Range, error) {
return nil, fmt.Errorf("invalid '%s' range: uint64 overflow", vs[i]) return nil, fmt.Errorf("invalid '%s' range: uint64 overflow", vs[i])
} }
rs[i] = object.NewRange() rs[i] = objectSDK.NewRange()
rs[i].SetOffset(offset) rs[i].SetOffset(offset)
rs[i].SetLength(length) rs[i].SetLength(length)
} }

View file

@ -10,7 +10,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oidSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oidSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -72,18 +72,18 @@ func searchObject(cmd *cobra.Command, _ []string) {
} }
} }
var searchUnaryOpVocabulary = map[string]object.SearchMatchType{ var searchUnaryOpVocabulary = map[string]objectSDK.SearchMatchType{
"NOPRESENT": object.MatchNotPresent, "NOPRESENT": objectSDK.MatchNotPresent,
} }
var searchBinaryOpVocabulary = map[string]object.SearchMatchType{ var searchBinaryOpVocabulary = map[string]objectSDK.SearchMatchType{
"EQ": object.MatchStringEqual, "EQ": objectSDK.MatchStringEqual,
"NE": object.MatchStringNotEqual, "NE": objectSDK.MatchStringNotEqual,
"COMMON_PREFIX": object.MatchCommonPrefix, "COMMON_PREFIX": objectSDK.MatchCommonPrefix,
} }
func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) { func parseSearchFilters(cmd *cobra.Command) (objectSDK.SearchFilters, error) {
var fs object.SearchFilters var fs objectSDK.SearchFilters
for i := range searchFilters { for i := range searchFilters {
words := strings.Fields(searchFilters[i]) words := strings.Fields(searchFilters[i])
@ -97,7 +97,7 @@ func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) {
return nil, fmt.Errorf("could not read attributes filter from file: %w", err) return nil, fmt.Errorf("could not read attributes filter from file: %w", err)
} }
subFs := object.NewSearchFilters() subFs := objectSDK.NewSearchFilters()
if err := subFs.UnmarshalJSON(data); err != nil { if err := subFs.UnmarshalJSON(data); err != nil {
return nil, fmt.Errorf("could not unmarshal attributes filter from file: %w", err) return nil, fmt.Errorf("could not unmarshal attributes filter from file: %w", err)
@ -138,7 +138,7 @@ func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) {
return nil, fmt.Errorf("could not parse object ID: %w", err) return nil, fmt.Errorf("could not parse object ID: %w", err)
} }
fs.AddObjectIDFilter(object.MatchStringEqual, id) fs.AddObjectIDFilter(objectSDK.MatchStringEqual, id)
} }
return fs, nil return fs, nil

View file

@ -16,7 +16,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -87,7 +87,7 @@ func readObjectAddress(cmd *cobra.Command, cnr *cid.ID, obj *oid.ID) oid.Address
func readObjectAddressBin(cmd *cobra.Command, cnr *cid.ID, obj *oid.ID, filename string) oid.Address { func readObjectAddressBin(cmd *cobra.Command, cnr *cid.ID, obj *oid.ID, filename string) oid.Address {
buf, err := os.ReadFile(filename) buf, err := os.ReadFile(filename)
commonCmd.ExitOnErr(cmd, "unable to read given file: %w", err) commonCmd.ExitOnErr(cmd, "unable to read given file: %w", err)
objTemp := object.New() objTemp := objectSDK.New()
commonCmd.ExitOnErr(cmd, "can't unmarshal object from given file: %w", objTemp.Unmarshal(buf)) commonCmd.ExitOnErr(cmd, "can't unmarshal object from given file: %w", objTemp.Unmarshal(buf))
var addr oid.Address var addr oid.Address
@ -356,7 +356,7 @@ func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID,
_, err := internal.HeadObject(cmd.Context(), prmHead) _, err := internal.HeadObject(cmd.Context(), prmHead)
var errSplit *object.SplitInfoError var errSplit *objectSDK.SplitInfoError
switch { switch {
default: default:
@ -381,7 +381,7 @@ func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID,
return tryRestoreChainInReverse(cmd, splitInfo, prmHead, cli, cnr, obj) return tryRestoreChainInReverse(cmd, splitInfo, prmHead, cli, cnr, obj)
} }
func tryGetSplitMembersByLinkingObject(cmd *cobra.Command, splitInfo *object.SplitInfo, prmHead internal.HeadObjectPrm, cnr cid.ID) ([]oid.ID, bool) { func tryGetSplitMembersByLinkingObject(cmd *cobra.Command, splitInfo *objectSDK.SplitInfo, prmHead internal.HeadObjectPrm, cnr cid.ID) ([]oid.ID, bool) {
// collect split chain by the descending ease of operations (ease is evaluated heuristically). // collect split chain by the descending ease of operations (ease is evaluated heuristically).
// If any approach fails, we don't try the next since we assume that it will fail too. // If any approach fails, we don't try the next since we assume that it will fail too.
@ -413,12 +413,12 @@ func tryGetSplitMembersByLinkingObject(cmd *cobra.Command, splitInfo *object.Spl
return nil, false return nil, false
} }
func tryGetSplitMembersBySplitID(cmd *cobra.Command, splitInfo *object.SplitInfo, cli *client.Client, cnr cid.ID) ([]oid.ID, bool) { func tryGetSplitMembersBySplitID(cmd *cobra.Command, splitInfo *objectSDK.SplitInfo, cli *client.Client, cnr cid.ID) ([]oid.ID, bool) {
if idSplit := splitInfo.SplitID(); idSplit != nil { if idSplit := splitInfo.SplitID(); idSplit != nil {
common.PrintVerbose(cmd, "Collecting split members by split ID...") common.PrintVerbose(cmd, "Collecting split members by split ID...")
var query object.SearchFilters var query objectSDK.SearchFilters
query.AddSplitIDFilter(object.MatchStringEqual, idSplit) query.AddSplitIDFilter(objectSDK.MatchStringEqual, idSplit)
var prm internal.SearchObjectsPrm var prm internal.SearchObjectsPrm
prm.SetContainerID(cnr) prm.SetContainerID(cnr)
@ -437,7 +437,7 @@ func tryGetSplitMembersBySplitID(cmd *cobra.Command, splitInfo *object.SplitInfo
return nil, false return nil, false
} }
func tryRestoreChainInReverse(cmd *cobra.Command, splitInfo *object.SplitInfo, prmHead internal.HeadObjectPrm, cli *client.Client, cnr cid.ID, obj oid.ID) []oid.ID { func tryRestoreChainInReverse(cmd *cobra.Command, splitInfo *objectSDK.SplitInfo, prmHead internal.HeadObjectPrm, cli *client.Client, cnr cid.ID, obj oid.ID) []oid.ID {
var addrObj oid.Address var addrObj oid.Address
addrObj.SetContainer(cnr) addrObj.SetContainer(cnr)
@ -482,8 +482,8 @@ func tryRestoreChainInReverse(cmd *cobra.Command, splitInfo *object.SplitInfo, p
common.PrintVerbose(cmd, "Looking for a linking object...") common.PrintVerbose(cmd, "Looking for a linking object...")
var query object.SearchFilters var query objectSDK.SearchFilters
query.AddParentIDFilter(object.MatchStringEqual, obj) query.AddParentIDFilter(objectSDK.MatchStringEqual, obj)
var prmSearch internal.SearchObjectsPrm var prmSearch internal.SearchObjectsPrm
prmSearch.SetClient(cli) prmSearch.SetClient(cli)

View file

@ -10,7 +10,7 @@ import (
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -68,7 +68,7 @@ func addByPath(cmd *cobra.Command, _ []string) {
req.Body = &tree.AddByPathRequest_Body{ req.Body = &tree.AddByPathRequest_Body{
ContainerId: rawCID, ContainerId: rawCID,
TreeId: tid, TreeId: tid,
PathAttribute: object.AttributeFileName, PathAttribute: objectSDK.AttributeFileName,
// PathAttribute: pAttr, // PathAttribute: pAttr,
Path: strings.Split(path, "/"), Path: strings.Split(path, "/"),
Meta: meta, Meta: meta,

View file

@ -10,7 +10,7 @@ import (
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -66,7 +66,7 @@ func getByPath(cmd *cobra.Command, _ []string) {
req.Body = &tree.GetNodeByPathRequest_Body{ req.Body = &tree.GetNodeByPathRequest_Body{
ContainerId: rawCID, ContainerId: rawCID,
TreeId: tid, TreeId: tid,
PathAttribute: object.AttributeFileName, PathAttribute: objectSDK.AttributeFileName,
// PathAttribute: pAttr, // PathAttribute: pAttr,
Path: strings.Split(path, "/"), Path: strings.Split(path, "/"),
LatestOnly: latestOnly, LatestOnly: latestOnly,

View file

@ -3,7 +3,7 @@ package blobovnicza
import ( import (
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobovnicza" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobovnicza"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -38,7 +38,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) {
data := res.Object() data := res.Object()
var o object.Object var o objectSDK.Object
common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w", common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w",
o.Unmarshal(data)), o.Unmarshal(data)),
) )

View file

@ -7,7 +7,7 @@ import (
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobovnicza" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobovnicza"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -49,7 +49,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) {
prm.SetAddress(addr) prm.SetAddress(addr)
prm.SetRaw(true) prm.SetRaw(true)
siErr := new(object.SplitInfoError) siErr := new(objectSDK.SplitInfoError)
res, err := db.Get(cmd.Context(), prm) res, err := db.Get(cmd.Context(), prm)
if errors.As(err, &siErr) { if errors.As(err, &siErr) {

View file

@ -4,14 +4,14 @@ import (
"os" "os"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// PrintObjectHeader prints passed object's header fields via // PrintObjectHeader prints passed object's header fields via
// the passed cobra command. Does nothing with the payload. // the passed cobra command. Does nothing with the payload.
func PrintObjectHeader(cmd *cobra.Command, h object.Object) { func PrintObjectHeader(cmd *cobra.Command, h objectSDK.Object) {
cmd.Println("Version:", h.Version()) cmd.Println("Version:", h.Version())
cmd.Println("Type:", h.Type()) cmd.Println("Type:", h.Type())
printContainerID(cmd, h.ContainerID) printContainerID(cmd, h.ContainerID)

View file

@ -3,7 +3,7 @@ package writecache
import ( import (
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -27,7 +27,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) {
data, err := writecache.Get(db, []byte(vAddress)) data, err := writecache.Get(db, []byte(vAddress))
common.ExitOnErr(cmd, common.Errf("could not fetch object: %w", err)) common.ExitOnErr(cmd, common.Errf("could not fetch object: %w", err))
var o object.Object var o objectSDK.Object
common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w", o.Unmarshal(data))) common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w", o.Unmarshal(data)))
common.PrintObjectHeader(cmd, o) common.PrintObjectHeader(cmd, o)

View file

@ -1,7 +1,7 @@
package object package object
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -9,5 +9,5 @@ import (
// object type. // object type.
type AddressWithType struct { type AddressWithType struct {
Address oid.Address Address oid.Address
Type object.Type Type objectSDK.Type
} }

View file

@ -12,7 +12,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa" frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
) )
@ -87,7 +87,7 @@ func NewFormatValidator(opts ...FormatValidatorOption) *FormatValidator {
// If unprepared is true, only fields set by user are validated. // If unprepared is true, only fields set by user are validated.
// //
// Returns nil error if the object has valid structure. // Returns nil error if the object has valid structure.
func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unprepared bool) error { func (v *FormatValidator) Validate(ctx context.Context, obj *objectSDK.Object, unprepared bool) error {
if obj == nil { if obj == nil {
return errNilObject return errNilObject
} }
@ -119,7 +119,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unpr
return fmt.Errorf("object did not pass expiration check: %w", err) return fmt.Errorf("object did not pass expiration check: %w", err)
} }
if err := object.CheckHeaderVerificationFields(obj); err != nil { if err := objectSDK.CheckHeaderVerificationFields(obj); err != nil {
return fmt.Errorf("(%T) could not validate header fields: %w", v, err) return fmt.Errorf("(%T) could not validate header fields: %w", v, err)
} }
} }
@ -132,7 +132,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unpr
return nil return nil
} }
func (v *FormatValidator) validateSignatureKey(obj *object.Object) error { func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
sig := obj.Signature() sig := obj.Signature()
if sig == nil { if sig == nil {
// TODO(@cthulhu-rider): #468 use "const" error // TODO(@cthulhu-rider): #468 use "const" error
@ -178,13 +178,13 @@ func (v *FormatValidator) checkOwnerKey(id user.ID, key frostfsecdsa.PublicKey)
// - object.TypeTombstone; // - object.TypeTombstone;
// - object.TypeLock. // - object.TypeLock.
type ContentMeta struct { type ContentMeta struct {
typ object.Type typ objectSDK.Type
objs []oid.ID objs []oid.ID
} }
// Type returns object's type. // Type returns object's type.
func (i ContentMeta) Type() object.Type { func (i ContentMeta) Type() objectSDK.Type {
return i.typ return i.typ
} }
@ -197,17 +197,17 @@ func (i ContentMeta) Objects() []oid.ID {
} }
// ValidateContent validates payload content according to the object type. // ValidateContent validates payload content according to the object type.
func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error) { func (v *FormatValidator) ValidateContent(o *objectSDK.Object) (ContentMeta, error) {
meta := ContentMeta{ meta := ContentMeta{
typ: o.Type(), typ: o.Type(),
} }
switch o.Type() { switch o.Type() {
case object.TypeTombstone: case objectSDK.TypeTombstone:
if err := v.fillAndValidateTombstoneMeta(o, &meta); err != nil { if err := v.fillAndValidateTombstoneMeta(o, &meta); err != nil {
return ContentMeta{}, err return ContentMeta{}, err
} }
case object.TypeLock: case objectSDK.TypeLock:
if err := v.fillAndValidateLockMeta(o, &meta); err != nil { if err := v.fillAndValidateLockMeta(o, &meta); err != nil {
return ContentMeta{}, err return ContentMeta{}, err
} }
@ -218,7 +218,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error)
return meta, nil return meta, nil
} }
func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *ContentMeta) error { func (v *FormatValidator) fillAndValidateLockMeta(o *objectSDK.Object, meta *ContentMeta) error {
if len(o.Payload()) == 0 { if len(o.Payload()) == 0 {
return errors.New("empty payload in lock") return errors.New("empty payload in lock")
} }
@ -240,7 +240,7 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *Conten
return fmt.Errorf("lock object expiration: %d; current: %d", lockExp, currEpoch) return fmt.Errorf("lock object expiration: %d; current: %d", lockExp, currEpoch)
} }
var lock object.Lock var lock objectSDK.Lock
if err = lock.Unmarshal(o.Payload()); err != nil { if err = lock.Unmarshal(o.Payload()); err != nil {
return fmt.Errorf("decode lock payload: %w", err) return fmt.Errorf("decode lock payload: %w", err)
@ -256,12 +256,12 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *Conten
return nil return nil
} }
func (v *FormatValidator) fillAndValidateTombstoneMeta(o *object.Object, meta *ContentMeta) error { func (v *FormatValidator) fillAndValidateTombstoneMeta(o *objectSDK.Object, meta *ContentMeta) error {
if len(o.Payload()) == 0 { if len(o.Payload()) == 0 {
return fmt.Errorf("(%T) empty payload in tombstone", v) return fmt.Errorf("(%T) empty payload in tombstone", v)
} }
tombstone := object.NewTombstone() tombstone := objectSDK.NewTombstone()
if err := tombstone.Unmarshal(o.Payload()); err != nil { if err := tombstone.Unmarshal(o.Payload()); err != nil {
return fmt.Errorf("(%T) could not unmarshal tombstone content: %w", v, err) return fmt.Errorf("(%T) could not unmarshal tombstone content: %w", v, err)
@ -287,7 +287,7 @@ func (v *FormatValidator) fillAndValidateTombstoneMeta(o *object.Object, meta *C
var errExpired = errors.New("object has expired") var errExpired = errors.New("object has expired")
func (v *FormatValidator) checkExpiration(ctx context.Context, obj *object.Object) error { func (v *FormatValidator) checkExpiration(ctx context.Context, obj *objectSDK.Object) error {
exp, err := expirationEpochAttribute(obj) exp, err := expirationEpochAttribute(obj)
if err != nil { if err != nil {
if errors.Is(err, errNoExpirationEpoch) { if errors.Is(err, errNoExpirationEpoch) {
@ -321,7 +321,7 @@ func (v *FormatValidator) checkExpiration(ctx context.Context, obj *object.Objec
return nil return nil
} }
func expirationEpochAttribute(obj *object.Object) (uint64, error) { func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) {
for _, a := range obj.Attributes() { for _, a := range obj.Attributes() {
if a.Key() != objectV2.SysAttributeExpEpoch && a.Key() != objectV2.SysAttributeExpEpochNeoFS { if a.Key() != objectV2.SysAttributeExpEpoch && a.Key() != objectV2.SysAttributeExpEpochNeoFS {
continue continue
@ -338,7 +338,7 @@ var (
errEmptyAttrVal = errors.New("empty attribute value") errEmptyAttrVal = errors.New("empty attribute value")
) )
func (v *FormatValidator) checkAttributes(obj *object.Object) error { func (v *FormatValidator) checkAttributes(obj *objectSDK.Object) error {
as := obj.Attributes() as := obj.Attributes()
mUnique := make(map[string]struct{}, len(as)) mUnique := make(map[string]struct{}, len(as))
@ -362,7 +362,7 @@ func (v *FormatValidator) checkAttributes(obj *object.Object) error {
var errIncorrectOwner = errors.New("incorrect object owner") var errIncorrectOwner = errors.New("incorrect object owner")
func (v *FormatValidator) checkOwner(obj *object.Object) error { func (v *FormatValidator) checkOwner(obj *objectSDK.Object) error {
if idOwner := obj.OwnerID(); idOwner == nil || len(idOwner.WalletBytes()) == 0 { if idOwner := obj.OwnerID(); idOwner == nil || len(idOwner.WalletBytes()) == 0 {
return errIncorrectOwner return errIncorrectOwner
} }

View file

@ -8,7 +8,7 @@ import (
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session/test" sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session/test"
@ -17,11 +17,11 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func blankValidObject(key *ecdsa.PrivateKey) *object.Object { func blankValidObject(key *ecdsa.PrivateKey) *objectSDK.Object {
var idOwner user.ID var idOwner user.ID
user.IDFromKey(&idOwner, key.PublicKey) user.IDFromKey(&idOwner, key.PublicKey)
obj := object.New() obj := objectSDK.New()
obj.SetContainerID(cidtest.ID()) obj.SetContainerID(cidtest.ID())
obj.SetOwnerID(&idOwner) obj.SetOwnerID(&idOwner)
@ -66,20 +66,20 @@ func TestFormatValidator_Validate(t *testing.T) {
}) })
t.Run("nil identifier", func(t *testing.T) { t.Run("nil identifier", func(t *testing.T) {
obj := object.New() obj := objectSDK.New()
require.ErrorIs(t, v.Validate(context.Background(), obj, false), errNilID) require.ErrorIs(t, v.Validate(context.Background(), obj, false), errNilID)
}) })
t.Run("nil container identifier", func(t *testing.T) { t.Run("nil container identifier", func(t *testing.T) {
obj := object.New() obj := objectSDK.New()
obj.SetID(oidtest.ID()) obj.SetID(oidtest.ID())
require.ErrorIs(t, v.Validate(context.Background(), obj, true), errNilCID) require.ErrorIs(t, v.Validate(context.Background(), obj, true), errNilCID)
}) })
t.Run("unsigned object", func(t *testing.T) { t.Run("unsigned object", func(t *testing.T) {
obj := object.New() obj := objectSDK.New()
obj.SetContainerID(cidtest.ID()) obj.SetContainerID(cidtest.ID())
obj.SetID(oidtest.ID()) obj.SetID(oidtest.ID())
@ -94,12 +94,12 @@ func TestFormatValidator_Validate(t *testing.T) {
err := tok.Sign(ownerKey.PrivateKey) err := tok.Sign(ownerKey.PrivateKey)
require.NoError(t, err) require.NoError(t, err)
obj := object.New() obj := objectSDK.New()
obj.SetContainerID(cidtest.ID()) obj.SetContainerID(cidtest.ID())
obj.SetSessionToken(tok) obj.SetSessionToken(tok)
obj.SetOwnerID(&idOwner) obj.SetOwnerID(&idOwner)
require.NoError(t, object.SetIDWithSignature(ownerKey.PrivateKey, obj)) require.NoError(t, objectSDK.SetIDWithSignature(ownerKey.PrivateKey, obj))
require.NoError(t, v.Validate(context.Background(), obj, false)) require.NoError(t, v.Validate(context.Background(), obj, false))
}) })
@ -107,20 +107,20 @@ func TestFormatValidator_Validate(t *testing.T) {
t.Run("correct w/o session token", func(t *testing.T) { t.Run("correct w/o session token", func(t *testing.T) {
obj := blankValidObject(&ownerKey.PrivateKey) obj := blankValidObject(&ownerKey.PrivateKey)
require.NoError(t, object.SetIDWithSignature(ownerKey.PrivateKey, obj)) require.NoError(t, objectSDK.SetIDWithSignature(ownerKey.PrivateKey, obj))
require.NoError(t, v.Validate(context.Background(), obj, false)) require.NoError(t, v.Validate(context.Background(), obj, false))
}) })
t.Run("tombstone content", func(t *testing.T) { t.Run("tombstone content", func(t *testing.T) {
obj := object.New() obj := objectSDK.New()
obj.SetType(object.TypeTombstone) obj.SetType(objectSDK.TypeTombstone)
obj.SetContainerID(cidtest.ID()) obj.SetContainerID(cidtest.ID())
_, err := v.ValidateContent(obj) _, err := v.ValidateContent(obj)
require.Error(t, err) // no tombstone content require.Error(t, err) // no tombstone content
content := object.NewTombstone() content := objectSDK.NewTombstone()
content.SetMembers([]oid.ID{oidtest.ID()}) content.SetMembers([]oid.ID{oidtest.ID()})
data, err := content.Marshal() data, err := content.Marshal()
@ -141,7 +141,7 @@ func TestFormatValidator_Validate(t *testing.T) {
_, err = v.ValidateContent(obj) _, err = v.ValidateContent(obj)
require.Error(t, err) // no expiration epoch in tombstone require.Error(t, err) // no expiration epoch in tombstone
var expirationAttribute object.Attribute var expirationAttribute objectSDK.Attribute
expirationAttribute.SetKey(objectV2.SysAttributeExpEpoch) expirationAttribute.SetKey(objectV2.SysAttributeExpEpoch)
expirationAttribute.SetValue(strconv.Itoa(10)) expirationAttribute.SetValue(strconv.Itoa(10))
@ -163,20 +163,20 @@ func TestFormatValidator_Validate(t *testing.T) {
require.NoError(t, err) // all good require.NoError(t, err) // all good
require.EqualValues(t, []oid.ID{id}, contentGot.Objects()) require.EqualValues(t, []oid.ID{id}, contentGot.Objects())
require.Equal(t, object.TypeTombstone, contentGot.Type()) require.Equal(t, objectSDK.TypeTombstone, contentGot.Type())
}) })
t.Run("expiration", func(t *testing.T) { t.Run("expiration", func(t *testing.T) {
fn := func(val string) *object.Object { fn := func(val string) *objectSDK.Object {
obj := blankValidObject(&ownerKey.PrivateKey) obj := blankValidObject(&ownerKey.PrivateKey)
var a object.Attribute var a objectSDK.Attribute
a.SetKey(objectV2.SysAttributeExpEpoch) a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(val) a.SetValue(val)
obj.SetAttributes(a) obj.SetAttributes(a)
require.NoError(t, object.SetIDWithSignature(ownerKey.PrivateKey, obj)) require.NoError(t, objectSDK.SetIDWithSignature(ownerKey.PrivateKey, obj))
return obj return obj
} }
@ -221,11 +221,11 @@ func TestFormatValidator_Validate(t *testing.T) {
t.Run("duplication", func(t *testing.T) { t.Run("duplication", func(t *testing.T) {
obj := blankValidObject(&ownerKey.PrivateKey) obj := blankValidObject(&ownerKey.PrivateKey)
var a1 object.Attribute var a1 objectSDK.Attribute
a1.SetKey("key1") a1.SetKey("key1")
a1.SetValue("val1") a1.SetValue("val1")
var a2 object.Attribute var a2 objectSDK.Attribute
a2.SetKey("key2") a2.SetKey("key2")
a2.SetValue("val2") a2.SetValue("val2")
@ -244,7 +244,7 @@ func TestFormatValidator_Validate(t *testing.T) {
t.Run("empty value", func(t *testing.T) { t.Run("empty value", func(t *testing.T) {
obj := blankValidObject(&ownerKey.PrivateKey) obj := blankValidObject(&ownerKey.PrivateKey)
var a object.Attribute var a objectSDK.Attribute
a.SetKey("key") a.SetKey("key")
obj.SetAttributes(a) obj.SetAttributes(a)

View file

@ -1,12 +1,12 @@
package object package object
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
// AddressOf returns the address of the object. // AddressOf returns the address of the object.
func AddressOf(obj *object.Object) oid.Address { func AddressOf(obj *objectSDK.Object) oid.Address {
var addr oid.Address var addr oid.Address
id, ok := obj.ID() id, ok := obj.ID()

View file

@ -18,7 +18,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"git.frostfs.info/TrueCloudLab/hrw" "git.frostfs.info/TrueCloudLab/hrw"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
@ -148,7 +148,7 @@ func newStorages(root string, smallSize uint64) []blobstor.SubStorage {
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1), blobovniczatree.WithBlobovniczaShallowWidth(1),
blobovniczatree.WithPermissions(0700)), blobovniczatree.WithPermissions(0700)),
Policy: func(_ *object.Object, data []byte) bool { Policy: func(_ *objectSDK.Object, data []byte) bool {
return uint64(len(data)) < smallSize return uint64(len(data)) < smallSize
}, },
}, },
@ -176,7 +176,7 @@ func newTestStorages(root string, smallSize uint64) ([]blobstor.SubStorage, *tes
return []blobstor.SubStorage{ return []blobstor.SubStorage{
{ {
Storage: smallFileStorage, Storage: smallFileStorage,
Policy: func(_ *object.Object, data []byte) bool { Policy: func(_ *objectSDK.Object, data []byte) bool {
return uint64(len(data)) < smallSize return uint64(len(data)) < smallSize
}, },
}, },

View file

@ -8,7 +8,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -17,7 +17,7 @@ func TestHeadRaw(t *testing.T) {
defer os.RemoveAll(t.Name()) defer os.RemoveAll(t.Name())
cnr := cidtest.ID() cnr := cidtest.ID()
splitID := object.NewSplitID() splitID := objectSDK.NewSplitID()
parent := testutil.GenerateObjectWithCID(cnr) parent := testutil.GenerateObjectWithCID(cnr)
testutil.AddAttribute(parent, "foo", "bar") testutil.AddAttribute(parent, "foo", "bar")
@ -70,7 +70,7 @@ func TestHeadRaw(t *testing.T) {
_, err = e.Head(context.Background(), headPrm) _, err = e.Head(context.Background(), headPrm)
require.Error(t, err) require.Error(t, err)
var si *object.SplitInfoError var si *objectSDK.SplitInfoError
require.ErrorAs(t, err, &si) require.ErrorAs(t, err, &si)
// SplitInfoError should contain info from both shards // SplitInfoError should contain info from both shards

View file

@ -15,7 +15,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
@ -83,7 +83,7 @@ func TestLockUserScenario(t *testing.T) {
lockerAddr.SetContainer(cnr) lockerAddr.SetContainer(cnr)
lockerAddr.SetObject(lockerID) lockerAddr.SetObject(lockerID)
var a object.Attribute var a objectSDK.Attribute
a.SetKey(objectV2.SysAttributeExpEpoch) a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.Itoa(lockerExpiresAfter)) a.SetValue(strconv.Itoa(lockerExpiresAfter))
@ -105,9 +105,9 @@ func TestLockUserScenario(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// 2. // 2.
var locker object.Lock var locker objectSDK.Lock
locker.WriteMembers([]oid.ID{id}) locker.WriteMembers([]oid.ID{id})
object.WriteLock(lockerObj, locker) objectSDK.WriteLock(lockerObj, locker)
err = Put(context.Background(), e, lockerObj) err = Put(context.Background(), e, lockerObj)
require.NoError(t, err) require.NoError(t, err)
@ -123,7 +123,7 @@ func TestLockUserScenario(t *testing.T) {
require.ErrorAs(t, err, new(apistatus.ObjectLocked)) require.ErrorAs(t, err, new(apistatus.ObjectLocked))
// 4. // 4.
tombObj.SetType(object.TypeTombstone) tombObj.SetType(objectSDK.TypeTombstone)
tombObj.SetID(tombForLockID) tombObj.SetID(tombForLockID)
tombObj.SetAttributes(a) tombObj.SetAttributes(a)
@ -188,12 +188,12 @@ func TestLockExpiration(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// 2. // 2.
var a object.Attribute var a objectSDK.Attribute
a.SetKey(objectV2.SysAttributeExpEpoch) a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.Itoa(lockerExpiresAfter)) a.SetValue(strconv.Itoa(lockerExpiresAfter))
lock := testutil.GenerateObjectWithCID(cnr) lock := testutil.GenerateObjectWithCID(cnr)
lock.SetType(object.TypeLock) lock.SetType(objectSDK.TypeLock)
lock.SetAttributes(a) lock.SetAttributes(a)
err = Put(context.Background(), e, lock) err = Put(context.Background(), e, lock)
@ -266,7 +266,7 @@ func TestLockForceRemoval(t *testing.T) {
// 2. // 2.
lock := testutil.GenerateObjectWithCID(cnr) lock := testutil.GenerateObjectWithCID(cnr)
lock.SetType(object.TypeLock) lock.SetType(objectSDK.TypeLock)
err = Put(context.Background(), e, lock) err = Put(context.Background(), e, lock)
require.NoError(t, err) require.NoError(t, err)

View file

@ -6,7 +6,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
@ -15,7 +15,7 @@ import (
// SelectPrm groups the parameters of Select operation. // SelectPrm groups the parameters of Select operation.
type SelectPrm struct { type SelectPrm struct {
cnr cid.ID cnr cid.ID
filters object.SearchFilters filters objectSDK.SearchFilters
} }
// SelectRes groups the resulting values of Select operation. // SelectRes groups the resulting values of Select operation.
@ -29,7 +29,7 @@ func (p *SelectPrm) WithContainerID(cnr cid.ID) {
} }
// WithFilters is a Select option to set the object filters. // WithFilters is a Select option to set the object filters.
func (p *SelectPrm) WithFilters(fs object.SearchFilters) { func (p *SelectPrm) WithFilters(fs objectSDK.SearchFilters) {
p.filters = fs p.filters = fs
} }
@ -144,7 +144,7 @@ func (e *StorageEngine) list(ctx context.Context, limit uint64) (SelectRes, erro
} }
// Select selects objects from local storage using provided filters. // Select selects objects from local storage using provided filters.
func Select(ctx context.Context, storage *StorageEngine, cnr cid.ID, fs object.SearchFilters) ([]oid.Address, error) { func Select(ctx context.Context, storage *StorageEngine, cnr cid.ID, fs objectSDK.SearchFilters) ([]oid.Address, error) {
var selectPrm SelectPrm var selectPrm SelectPrm
selectPrm.WithContainerID(cnr) selectPrm.WithContainerID(cnr)
selectPrm.WithFilters(fs) selectPrm.WithFilters(fs)

View file

@ -8,7 +8,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
func BenchmarkTreeVsSearch(b *testing.B) { func BenchmarkTreeVsSearch(b *testing.B) {
@ -47,8 +47,8 @@ func benchmarkTreeVsSearch(b *testing.B, objCount int) {
var prm SelectPrm var prm SelectPrm
prm.WithContainerID(cid) prm.WithContainerID(cid)
var fs object.SearchFilters var fs objectSDK.SearchFilters
fs.AddFilter(pilorama.AttributeFilename, strconv.Itoa(objCount/2), object.MatchStringEqual) fs.AddFilter(pilorama.AttributeFilename, strconv.Itoa(objCount/2), objectSDK.MatchStringEqual)
prm.WithFilters(fs) prm.WithFilters(fs)
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {

View file

@ -6,7 +6,7 @@ import (
"testing" "testing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/exp/rand" "golang.org/x/exp/rand"
@ -48,7 +48,7 @@ func (g RandAddrGenerator) Next() oid.Address {
// ObjectGenerator is the interface of types that generate object entries. // ObjectGenerator is the interface of types that generate object entries.
type ObjectGenerator interface { type ObjectGenerator interface {
Next() *object.Object Next() *objectSDK.Object
} }
// SeqObjGenerator is an ObjectGenerator that generates entries with random payloads of size objSize and sequential IDs. // SeqObjGenerator is an ObjectGenerator that generates entries with random payloads of size objSize and sequential IDs.
@ -59,7 +59,7 @@ type SeqObjGenerator struct {
var _ ObjectGenerator = &SeqObjGenerator{} var _ ObjectGenerator = &SeqObjGenerator{}
func generateObjectWithOIDWithCIDWithSize(oid oid.ID, cid cid.ID, sz uint64) *object.Object { func generateObjectWithOIDWithCIDWithSize(oid oid.ID, cid cid.ID, sz uint64) *objectSDK.Object {
data := make([]byte, sz) data := make([]byte, sz)
_, _ = rand.Read(data) _, _ = rand.Read(data)
obj := GenerateObjectWithCIDWithPayload(cid, data) obj := GenerateObjectWithCIDWithPayload(cid, data)
@ -67,7 +67,7 @@ func generateObjectWithOIDWithCIDWithSize(oid oid.ID, cid cid.ID, sz uint64) *ob
return obj return obj
} }
func (g *SeqObjGenerator) Next() *object.Object { func (g *SeqObjGenerator) Next() *objectSDK.Object {
var id oid.ID var id oid.ID
binary.LittleEndian.PutUint64(id[:], g.cnt.Add(1)) binary.LittleEndian.PutUint64(id[:], g.cnt.Add(1))
return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize) return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize)
@ -80,7 +80,7 @@ type RandObjGenerator struct {
var _ ObjectGenerator = &RandObjGenerator{} var _ ObjectGenerator = &RandObjGenerator{}
func (g *RandObjGenerator) Next() *object.Object { func (g *RandObjGenerator) Next() *objectSDK.Object {
var id oid.ID var id oid.ID
_, _ = rand.Read(id[:]) _, _ = rand.Read(id[:])
return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize) return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize)
@ -92,13 +92,13 @@ type OverwriteObjGenerator struct {
MaxObjects uint64 MaxObjects uint64
} }
func (g *OverwriteObjGenerator) Next() *object.Object { func (g *OverwriteObjGenerator) Next() *objectSDK.Object {
var id oid.ID var id oid.ID
binary.LittleEndian.PutUint64(id[:], uint64(1+rand.Int63n(int64(g.MaxObjects)))) binary.LittleEndian.PutUint64(id[:], uint64(1+rand.Int63n(int64(g.MaxObjects))))
return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize) return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize)
} }
func AddressFromObject(t testing.TB, obj *object.Object) oid.Address { func AddressFromObject(t testing.TB, obj *objectSDK.Object) oid.Address {
var addr oid.Address var addr oid.Address
id, isSet := obj.ID() id, isSet := obj.ID()

View file

@ -6,7 +6,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
@ -16,17 +16,17 @@ import (
const defaultDataSize = 32 const defaultDataSize = 32
func GenerateObject() *object.Object { func GenerateObject() *objectSDK.Object {
return GenerateObjectWithCID(cidtest.ID()) return GenerateObjectWithCID(cidtest.ID())
} }
func GenerateObjectWithCID(cnr cid.ID) *object.Object { func GenerateObjectWithCID(cnr cid.ID) *objectSDK.Object {
data := make([]byte, defaultDataSize) data := make([]byte, defaultDataSize)
_, _ = rand.Read(data) _, _ = rand.Read(data)
return GenerateObjectWithCIDWithPayload(cnr, data) return GenerateObjectWithCIDWithPayload(cnr, data)
} }
func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *object.Object { func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *objectSDK.Object {
var ver version.Version var ver version.Version
ver.SetMajor(2) ver.SetMajor(2)
ver.SetMinor(1) ver.SetMinor(1)
@ -37,7 +37,7 @@ func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *object.Object {
var csumTZ checksum.Checksum var csumTZ checksum.Checksum
csumTZ.SetTillichZemor(tz.Sum(csum.Value())) csumTZ.SetTillichZemor(tz.Sum(csum.Value()))
obj := object.New() obj := objectSDK.New()
obj.SetID(oidtest.ID()) obj.SetID(oidtest.ID())
obj.SetOwnerID(usertest.ID()) obj.SetOwnerID(usertest.ID())
obj.SetContainerID(cnr) obj.SetContainerID(cnr)
@ -49,8 +49,8 @@ func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *object.Object {
return obj return obj
} }
func AddAttribute(obj *object.Object, key, val string) { func AddAttribute(obj *objectSDK.Object, key, val string) {
var attr object.Attribute var attr objectSDK.Attribute
attr.SetKey(key) attr.SetKey(key)
attr.SetValue(val) attr.SetValue(val)
@ -59,7 +59,7 @@ func AddAttribute(obj *object.Object, key, val string) {
obj.SetAttributes(attrs...) obj.SetAttributes(attrs...)
} }
func AddPayload(obj *object.Object, size int) { func AddPayload(obj *objectSDK.Object, size int) {
buf := make([]byte, size) buf := make([]byte, size)
_, _ = rand.Read(buf) _, _ = rand.Read(buf)

View file

@ -8,7 +8,7 @@ import (
objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -34,7 +34,7 @@ func TestCounters(t *testing.T) {
t.Run("put", func(t *testing.T) { t.Run("put", func(t *testing.T) {
t.Parallel() t.Parallel()
db := newDB(t) db := newDB(t)
oo := make([]*object.Object, 0, objCount) oo := make([]*objectSDK.Object, 0, objCount)
for i := 0; i < objCount; i++ { for i := 0; i < objCount; i++ {
oo = append(oo, testutil.GenerateObject()) oo = append(oo, testutil.GenerateObject())
} }
@ -191,7 +191,7 @@ func TestCounters_Expired(t *testing.T) {
oo := make([]oid.Address, objCount) oo := make([]oid.Address, objCount)
for i := range oo { for i := range oo {
oo[i] = putWithExpiration(t, db, object.TypeRegular, epoch+1) oo[i] = putWithExpiration(t, db, objectSDK.TypeRegular, epoch+1)
} }
// 1. objects are available and counters are correct // 1. objects are available and counters are correct
@ -275,12 +275,12 @@ func TestCounters_Expired(t *testing.T) {
require.Equal(t, uint64(len(oo)), c.Logic()) require.Equal(t, uint64(len(oo)), c.Logic())
} }
func putObjs(t *testing.T, db *meta.DB, count int, withParent bool) []*object.Object { func putObjs(t *testing.T, db *meta.DB, count int, withParent bool) []*objectSDK.Object {
var prm meta.PutPrm var prm meta.PutPrm
var err error var err error
parent := testutil.GenerateObject() parent := testutil.GenerateObject()
oo := make([]*object.Object, 0, count) oo := make([]*objectSDK.Object, 0, count)
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
o := testutil.GenerateObject() o := testutil.GenerateObject()
if withParent { if withParent {

View file

@ -14,7 +14,7 @@ import (
v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"github.com/mr-tron/base58" "github.com/mr-tron/base58"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
@ -39,7 +39,7 @@ type DB struct {
modeMtx sync.RWMutex modeMtx sync.RWMutex
mode mode.Mode mode mode.Mode
matchers map[object.SearchMatchType]matcher matchers map[objectSDK.SearchMatchType]matcher
boltDB *bbolt.DB boltDB *bbolt.DB
@ -89,20 +89,20 @@ func New(opts ...Option) *DB {
return &DB{ return &DB{
cfg: c, cfg: c,
matchers: map[object.SearchMatchType]matcher{ matchers: map[objectSDK.SearchMatchType]matcher{
object.MatchUnknown: { objectSDK.MatchUnknown: {
matchSlow: unknownMatcher, matchSlow: unknownMatcher,
matchBucket: unknownMatcherBucket, matchBucket: unknownMatcherBucket,
}, },
object.MatchStringEqual: { objectSDK.MatchStringEqual: {
matchSlow: stringEqualMatcher, matchSlow: stringEqualMatcher,
matchBucket: stringEqualMatcherBucket, matchBucket: stringEqualMatcherBucket,
}, },
object.MatchStringNotEqual: { objectSDK.MatchStringNotEqual: {
matchSlow: stringNotEqualMatcher, matchSlow: stringNotEqualMatcher,
matchBucket: stringNotEqualMatcherBucket, matchBucket: stringNotEqualMatcherBucket,
}, },
object.MatchCommonPrefix: { objectSDK.MatchCommonPrefix: {
matchSlow: stringCommonPrefixMatcher, matchSlow: stringCommonPrefixMatcher,
matchBucket: stringCommonPrefixMatcherBucket, matchBucket: stringCommonPrefixMatcherBucket,
}, },
@ -276,7 +276,7 @@ func bucketKeyHelper(hdr string, val string) []byte {
return v return v
case v2object.FilterHeaderSplitID: case v2object.FilterHeaderSplitID:
s := object.NewSplitID() s := objectSDK.NewSplitID()
err := s.Parse(val) err := s.Parse(val)
if err != nil { if err != nil {

View file

@ -6,7 +6,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -77,7 +77,7 @@ func TestDB_SelectExpired(t *testing.T) {
require.Contains(t, expired, getAddressSafe(t, expiredObj22)) require.Contains(t, expired, getAddressSafe(t, expiredObj22))
} }
func getAddressSafe(t *testing.T, o *object.Object) oid.Address { func getAddressSafe(t *testing.T, o *objectSDK.Object) oid.Address {
cid, set := o.ContainerID() cid, set := o.ContainerID()
if !set { if !set {
t.Fatalf("container id required") t.Fatalf("container id required")

View file

@ -12,7 +12,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -276,7 +276,7 @@ func (db *DB) markAsGC(graveyardBKT, garbageBKT *bbolt.Bucket, key []byte) (bool
return false, garbageBKT.Put(key, zeroValue) return false, garbageBKT.Put(key, zeroValue)
} }
func (db *DB) updateDeleteInfo(tx *bbolt.Tx, garbageBKT, graveyardBKT *bbolt.Bucket, targetKey []byte, cnr cid.ID, obj *object.Object, res *InhumeRes) error { func (db *DB) updateDeleteInfo(tx *bbolt.Tx, garbageBKT, graveyardBKT *bbolt.Bucket, targetKey []byte, cnr cid.ID, obj *objectSDK.Object, res *InhumeRes) error {
containerID, _ := obj.ContainerID() containerID, _ := obj.ContainerID()
if inGraveyardWithKey(targetKey, graveyardBKT, garbageBKT) == 0 { if inGraveyardWithKey(targetKey, graveyardBKT, garbageBKT) == 0 {
res.availableImhumed++ res.availableImhumed++
@ -285,7 +285,7 @@ func (db *DB) updateDeleteInfo(tx *bbolt.Tx, garbageBKT, graveyardBKT *bbolt.Buc
// if object is stored, and it is regular object then update bucket // if object is stored, and it is regular object then update bucket
// with container size estimations // with container size estimations
if obj.Type() == object.TypeRegular { if obj.Type() == objectSDK.TypeRegular {
err := changeContainerSize(tx, cnr, obj.PayloadSize(), false) err := changeContainerSize(tx, cnr, obj.PayloadSize(), false)
if err != nil { if err != nil {
return err return err

View file

@ -12,7 +12,8 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
@ -21,13 +22,13 @@ import (
// ExpiredObject is a descriptor of expired object from DB. // ExpiredObject is a descriptor of expired object from DB.
type ExpiredObject struct { type ExpiredObject struct {
typ object.Type typ objectSDK.Type
addr oid.Address addr oid.Address
} }
// Type returns type of the expired object. // Type returns type of the expired object.
func (e *ExpiredObject) Type() object.Type { func (e *ExpiredObject) Type() objectSDK.Type {
return e.typ return e.typ
} }

View file

@ -9,7 +9,7 @@ import (
object2 "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" object2 "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -20,19 +20,19 @@ func TestDB_IterateExpired(t *testing.T) {
const epoch = 13 const epoch = 13
mAlive := map[object.Type]oid.Address{} mAlive := map[objectSDK.Type]oid.Address{}
mExpired := map[object.Type]oid.Address{} mExpired := map[objectSDK.Type]oid.Address{}
for _, typ := range []object.Type{ for _, typ := range []objectSDK.Type{
object.TypeRegular, objectSDK.TypeRegular,
object.TypeTombstone, objectSDK.TypeTombstone,
object.TypeLock, objectSDK.TypeLock,
} { } {
mAlive[typ] = putWithExpiration(t, db, typ, epoch) mAlive[typ] = putWithExpiration(t, db, typ, epoch)
mExpired[typ] = putWithExpiration(t, db, typ, epoch-1) mExpired[typ] = putWithExpiration(t, db, typ, epoch-1)
} }
expiredLocked := putWithExpiration(t, db, object.TypeRegular, epoch-1) expiredLocked := putWithExpiration(t, db, objectSDK.TypeRegular, epoch-1)
require.NoError(t, db.Lock(context.Background(), expiredLocked.Container(), oidtest.ID(), []oid.ID{expiredLocked.Object()})) require.NoError(t, db.Lock(context.Background(), expiredLocked.Container(), oidtest.ID(), []oid.ID{expiredLocked.Object()}))
@ -56,7 +56,7 @@ func TestDB_IterateExpired(t *testing.T) {
require.Empty(t, mExpired) require.Empty(t, mExpired)
} }
func putWithExpiration(t *testing.T, db *meta.DB, typ object.Type, expiresAt uint64) oid.Address { func putWithExpiration(t *testing.T, db *meta.DB, typ objectSDK.Type, expiresAt uint64) oid.Address {
obj := testutil.GenerateObject() obj := testutil.GenerateObject()
obj.SetType(typ) obj.SetType(typ)
testutil.AddAttribute(obj, objectV2.SysAttributeExpEpoch, strconv.FormatUint(expiresAt, 10)) testutil.AddAttribute(obj, objectV2.SysAttributeExpEpoch, strconv.FormatUint(expiresAt, 10))

View file

@ -9,7 +9,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
@ -124,15 +124,15 @@ loop:
continue continue
} }
var objType object.Type var objType objectSDK.Type
switch prefix { switch prefix {
case primaryPrefix: case primaryPrefix:
objType = object.TypeRegular objType = objectSDK.TypeRegular
case lockersPrefix: case lockersPrefix:
objType = object.TypeLock objType = objectSDK.TypeLock
case tombstonePrefix: case tombstonePrefix:
objType = object.TypeTombstone objType = objectSDK.TypeTombstone
default: default:
continue continue
} }
@ -175,7 +175,7 @@ loop:
// selectNFromBucket similar to selectAllFromBucket but uses cursor to find // selectNFromBucket similar to selectAllFromBucket but uses cursor to find
// object to start selecting from. Ignores inhumed objects. // object to start selecting from. Ignores inhumed objects.
func selectNFromBucket(bkt *bbolt.Bucket, // main bucket func selectNFromBucket(bkt *bbolt.Bucket, // main bucket
objType object.Type, // type of the objects stored in the main bucket objType objectSDK.Type, // type of the objects stored in the main bucket
graveyardBkt, garbageBkt *bbolt.Bucket, // cached graveyard buckets graveyardBkt, garbageBkt *bbolt.Bucket, // cached graveyard buckets
cidRaw []byte, // container ID prefix, optimization cidRaw []byte, // container ID prefix, optimization
cnt cid.ID, // container ID cnt cid.ID, // container ID

View file

@ -11,7 +11,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
@ -79,7 +79,7 @@ func (db *DB) lockInternal(locked []oid.ID, cnr cid.ID, locker oid.ID) error {
key := make([]byte, cidSize) key := make([]byte, cidSize)
return metaerr.Wrap(db.boltDB.Update(func(tx *bbolt.Tx) error { return metaerr.Wrap(db.boltDB.Update(func(tx *bbolt.Tx) error {
if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != object.TypeRegular { if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != objectSDK.TypeRegular {
return logicerr.Wrap(apistatus.LockNonRegularObject{}) return logicerr.Wrap(apistatus.LockNonRegularObject{})
} }

View file

@ -9,7 +9,7 @@ import (
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
objecttest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/test" objecttest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/test"
@ -28,10 +28,10 @@ func TestDB_Lock(t *testing.T) {
}) })
t.Run("(ir)regular", func(t *testing.T) { t.Run("(ir)regular", func(t *testing.T) {
for _, typ := range [...]object.Type{ for _, typ := range [...]objectSDK.Type{
object.TypeTombstone, objectSDK.TypeTombstone,
object.TypeLock, objectSDK.TypeLock,
object.TypeRegular, objectSDK.TypeRegular,
} { } {
obj := objecttest.Object() obj := objecttest.Object()
obj.SetType(typ) obj.SetType(typ)
@ -47,7 +47,7 @@ func TestDB_Lock(t *testing.T) {
// try to lock it // try to lock it
err = db.Lock(context.Background(), cnr, oidtest.ID(), []oid.ID{id}) err = db.Lock(context.Background(), cnr, oidtest.ID(), []oid.ID{id})
if typ == object.TypeRegular { if typ == objectSDK.TypeRegular {
require.NoError(t, err, typ) require.NoError(t, err, typ)
} else { } else {
require.ErrorAs(t, err, &e, typ) require.ErrorAs(t, err, &e, typ)
@ -180,7 +180,7 @@ func TestDB_Lock_Expired(t *testing.T) {
db := newDB(t, meta.WithEpochState(es)) db := newDB(t, meta.WithEpochState(es))
// put an object // put an object
addr := putWithExpiration(t, db, object.TypeRegular, 124) addr := putWithExpiration(t, db, objectSDK.TypeRegular, 124)
// expire the obj // expire the obj
es.e = 125 es.e = 125
@ -242,10 +242,10 @@ func TestDB_IsLocked(t *testing.T) {
} }
// putAndLockObj puts object, returns it and its locker. // putAndLockObj puts object, returns it and its locker.
func putAndLockObj(t *testing.T, db *meta.DB, numOfLockedObjs int) ([]*object.Object, *object.Object) { func putAndLockObj(t *testing.T, db *meta.DB, numOfLockedObjs int) ([]*objectSDK.Object, *objectSDK.Object) {
cnr := cidtest.ID() cnr := cidtest.ID()
lockedObjs := make([]*object.Object, 0, numOfLockedObjs) lockedObjs := make([]*objectSDK.Object, 0, numOfLockedObjs)
lockedObjIDs := make([]oid.ID, 0, numOfLockedObjs) lockedObjIDs := make([]oid.ID, 0, numOfLockedObjs)
for i := 0; i < numOfLockedObjs; i++ { for i := 0; i < numOfLockedObjs; i++ {
@ -261,7 +261,7 @@ func putAndLockObj(t *testing.T, db *meta.DB, numOfLockedObjs int) ([]*object.Ob
lockObj := testutil.GenerateObjectWithCID(cnr) lockObj := testutil.GenerateObjectWithCID(cnr)
lockID, _ := lockObj.ID() lockID, _ := lockObj.ID()
lockObj.SetType(object.TypeLock) lockObj.SetType(objectSDK.TypeLock)
err := putBig(db, lockObj) err := putBig(db, lockObj)
require.NoError(t, err) require.NoError(t, err)

View file

@ -13,7 +13,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
@ -31,14 +31,14 @@ type (
cnr cid.ID cnr cid.ID
fastFilters, slowFilters object.SearchFilters fastFilters, slowFilters objectSDK.SearchFilters
} }
) )
// SelectPrm groups the parameters of Select operation. // SelectPrm groups the parameters of Select operation.
type SelectPrm struct { type SelectPrm struct {
cnr cid.ID cnr cid.ID
filters object.SearchFilters filters objectSDK.SearchFilters
} }
// SelectRes groups the resulting values of Select operation. // SelectRes groups the resulting values of Select operation.
@ -52,7 +52,7 @@ func (p *SelectPrm) SetContainerID(cnr cid.ID) {
} }
// SetFilters is a Select option to set the object filters. // SetFilters is a Select option to set the object filters.
func (p *SelectPrm) SetFilters(fs object.SearchFilters) { func (p *SelectPrm) SetFilters(fs objectSDK.SearchFilters) {
p.filters = fs p.filters = fs
} }
@ -98,7 +98,7 @@ func (db *DB) Select(ctx context.Context, prm SelectPrm) (res SelectRes, err err
})) }))
} }
func (db *DB) selectObjects(tx *bbolt.Tx, cnr cid.ID, fs object.SearchFilters, currEpoch uint64) ([]oid.Address, error) { func (db *DB) selectObjects(tx *bbolt.Tx, cnr cid.ID, fs objectSDK.SearchFilters, currEpoch uint64) ([]oid.Address, error) {
group, err := groupFilters(fs) group, err := groupFilters(fs)
if err != nil { if err != nil {
return nil, err return nil, err
@ -186,7 +186,7 @@ func selectAllFromBucket(tx *bbolt.Tx, name []byte, to map[string]int, fNum int)
func (db *DB) selectFastFilter( func (db *DB) selectFastFilter(
tx *bbolt.Tx, tx *bbolt.Tx,
cnr cid.ID, // container we search on cnr cid.ID, // container we search on
f object.SearchFilter, // fast filter f objectSDK.SearchFilter, // fast filter
to map[string]int, // resulting cache to map[string]int, // resulting cache
fNum int, // index of filter fNum int, // index of filter
) { ) {
@ -220,7 +220,7 @@ func (db *DB) selectFastFilter(
default: // user attribute default: // user attribute
bucketName := attributeBucketName(cnr, f.Header(), bucketName) bucketName := attributeBucketName(cnr, f.Header(), bucketName)
if f.Operation() == object.MatchNotPresent { if f.Operation() == objectSDK.MatchNotPresent {
selectOutsideFKBT(tx, allBucketNames(cnr), bucketName, to, fNum) selectOutsideFKBT(tx, allBucketNames(cnr), bucketName, to, fNum)
} else { } else {
db.selectFromFKBT(tx, bucketName, f, to, fNum) db.selectFromFKBT(tx, bucketName, f, to, fNum)
@ -244,7 +244,7 @@ func allBucketNames(cnr cid.ID) (names [][]byte) {
return return
} }
func bucketNamesForType(cnr cid.ID, mType object.SearchMatchType, typeVal string) (names [][]byte) { func bucketNamesForType(cnr cid.ID, mType objectSDK.SearchMatchType, typeVal string) (names [][]byte) {
appendNames := func(key string) { appendNames := func(key string) {
fns, ok := mBucketNaming[key] fns, ok := mBucketNaming[key]
if ok { if ok {
@ -256,15 +256,15 @@ func bucketNamesForType(cnr cid.ID, mType object.SearchMatchType, typeVal string
switch mType { switch mType {
default: default:
case object.MatchStringNotEqual: case objectSDK.MatchStringNotEqual:
for key := range mBucketNaming { for key := range mBucketNaming {
if key != typeVal { if key != typeVal {
appendNames(key) appendNames(key)
} }
} }
case object.MatchStringEqual: case objectSDK.MatchStringEqual:
appendNames(typeVal) appendNames(typeVal)
case object.MatchCommonPrefix: case objectSDK.MatchCommonPrefix:
for key := range mBucketNaming { for key := range mBucketNaming {
if strings.HasPrefix(key, typeVal) { if strings.HasPrefix(key, typeVal) {
appendNames(key) appendNames(key)
@ -280,7 +280,7 @@ func bucketNamesForType(cnr cid.ID, mType object.SearchMatchType, typeVal string
func (db *DB) selectFromFKBT( func (db *DB) selectFromFKBT(
tx *bbolt.Tx, tx *bbolt.Tx,
name []byte, // fkbt root bucket name name []byte, // fkbt root bucket name
f object.SearchFilter, // filter for operation and value f objectSDK.SearchFilter, // filter for operation and value
to map[string]int, // resulting cache to map[string]int, // resulting cache
fNum int, // index of filter fNum int, // index of filter
) { // ) { //
@ -357,7 +357,7 @@ func selectOutsideFKBT(
func (db *DB) selectFromList( func (db *DB) selectFromList(
tx *bbolt.Tx, tx *bbolt.Tx,
name []byte, // list root bucket name name []byte, // list root bucket name
f object.SearchFilter, // filter for operation and value f objectSDK.SearchFilter, // filter for operation and value
to map[string]int, // resulting cache to map[string]int, // resulting cache
fNum int, // index of filter fNum int, // index of filter
) { // ) { //
@ -372,7 +372,7 @@ func (db *DB) selectFromList(
) )
switch op := f.Operation(); op { switch op := f.Operation(); op {
case object.MatchStringEqual: case objectSDK.MatchStringEqual:
lst, err = decodeList(bkt.Get(bucketKeyHelper(f.Header(), f.Value()))) lst, err = decodeList(bkt.Get(bucketKeyHelper(f.Header(), f.Value())))
if err != nil { if err != nil {
db.log.Debug(logs.MetabaseCantDecodeListBucketLeaf, zap.String("error", err.Error())) db.log.Debug(logs.MetabaseCantDecodeListBucketLeaf, zap.String("error", err.Error()))
@ -416,7 +416,7 @@ func (db *DB) selectFromList(
// selectObjectID processes objectID filter with in-place optimizations. // selectObjectID processes objectID filter with in-place optimizations.
func (db *DB) selectObjectID( func (db *DB) selectObjectID(
tx *bbolt.Tx, tx *bbolt.Tx,
f object.SearchFilter, f objectSDK.SearchFilter,
cnr cid.ID, cnr cid.ID,
to map[string]int, // resulting cache to map[string]int, // resulting cache
fNum int, // index of filter fNum int, // index of filter
@ -436,7 +436,7 @@ func (db *DB) selectObjectID(
} }
switch op := f.Operation(); op { switch op := f.Operation(); op {
case object.MatchStringEqual: case objectSDK.MatchStringEqual:
var id oid.ID var id oid.ID
if err := id.DecodeString(f.Value()); err == nil { if err := id.DecodeString(f.Value()); err == nil {
appendOID(id) appendOID(id)
@ -451,7 +451,7 @@ func (db *DB) selectObjectID(
return return
} }
for _, bucketName := range bucketNamesForType(cnr, object.MatchStringNotEqual, "") { for _, bucketName := range bucketNamesForType(cnr, objectSDK.MatchStringNotEqual, "") {
// copy-paste from DB.selectAllFrom // copy-paste from DB.selectAllFrom
bkt := tx.Bucket(bucketName) bkt := tx.Bucket(bucketName)
if bkt == nil { if bkt == nil {
@ -475,7 +475,7 @@ func (db *DB) selectObjectID(
} }
// matchSlowFilters return true if object header is matched by all slow filters. // matchSlowFilters return true if object header is matched by all slow filters.
func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr oid.Address, f object.SearchFilters, currEpoch uint64) bool { func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr oid.Address, f objectSDK.SearchFilters, currEpoch uint64) bool {
if len(f) == 0 { if len(f) == 0 {
return true return true
} }
@ -521,10 +521,10 @@ func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr oid.Address, f object.SearchFi
// groupFilters divides filters in two groups: fast and slow. Fast filters // groupFilters divides filters in two groups: fast and slow. Fast filters
// processed by indexes and slow filters processed after by unmarshaling // processed by indexes and slow filters processed after by unmarshaling
// object headers. // object headers.
func groupFilters(filters object.SearchFilters) (filterGroup, error) { func groupFilters(filters objectSDK.SearchFilters) (filterGroup, error) {
res := filterGroup{ res := filterGroup{
fastFilters: make(object.SearchFilters, 0, len(filters)), fastFilters: make(objectSDK.SearchFilters, 0, len(filters)),
slowFilters: make(object.SearchFilters, 0, len(filters)), slowFilters: make(objectSDK.SearchFilters, 0, len(filters)),
} }
for i := range filters { for i := range filters {
@ -557,9 +557,9 @@ func markAddressInCache(cache map[string]int, fNum int, addr string) {
} }
// Returns true if at least 1 object can satisfy fs. // Returns true if at least 1 object can satisfy fs.
func checkNonEmpty(fs object.SearchFilters) bool { func checkNonEmpty(fs objectSDK.SearchFilters) bool {
for i := range fs { for i := range fs {
if fs[i].Operation() == object.MatchNotPresent && isSystemKey(fs[i].Header()) { if fs[i].Operation() == objectSDK.MatchNotPresent && isSystemKey(fs[i].Header()) {
return true return true
} }
} }

View file

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
) )
@ -120,7 +120,7 @@ const (
addressKeySize = cidSize + objectKeySize addressKeySize = cidSize + objectKeySize
) )
var splitInfoError *object.SplitInfoError // for errors.As comparisons var splitInfoError *objectSDK.SplitInfoError // for errors.As comparisons
func bucketName(cnr cid.ID, prefix byte, key []byte) []byte { func bucketName(cnr cid.ID, prefix byte, key []byte) []byte {
key[0] = prefix key[0] = prefix
@ -221,7 +221,7 @@ func objectKey(obj oid.ID, key []byte) []byte {
// if meets irregular object container in objs - returns its type, otherwise returns object.TypeRegular. // if meets irregular object container in objs - returns its type, otherwise returns object.TypeRegular.
// //
// firstIrregularObjectType(tx, cnr, obj) usage allows getting object type. // firstIrregularObjectType(tx, cnr, obj) usage allows getting object type.
func firstIrregularObjectType(tx *bbolt.Tx, idCnr cid.ID, objs ...[]byte) object.Type { func firstIrregularObjectType(tx *bbolt.Tx, idCnr cid.ID, objs ...[]byte) objectSDK.Type {
if len(objs) == 0 { if len(objs) == 0 {
panic("empty object list in firstIrregularObjectType") panic("empty object list in firstIrregularObjectType")
} }
@ -229,11 +229,11 @@ func firstIrregularObjectType(tx *bbolt.Tx, idCnr cid.ID, objs ...[]byte) object
var keys [2][1 + cidSize]byte var keys [2][1 + cidSize]byte
irregularTypeBuckets := [...]struct { irregularTypeBuckets := [...]struct {
typ object.Type typ objectSDK.Type
name []byte name []byte
}{ }{
{object.TypeTombstone, tombstoneBucketName(idCnr, keys[0][:])}, {objectSDK.TypeTombstone, tombstoneBucketName(idCnr, keys[0][:])},
{object.TypeLock, bucketNameLockers(idCnr, keys[1][:])}, {objectSDK.TypeLock, bucketNameLockers(idCnr, keys[1][:])},
} }
for i := range objs { for i := range objs {
@ -244,7 +244,7 @@ func firstIrregularObjectType(tx *bbolt.Tx, idCnr cid.ID, objs ...[]byte) object
} }
} }
return object.TypeRegular return objectSDK.TypeRegular
} }
// return true if provided object is of LOCK type. // return true if provided object is of LOCK type.

View file

@ -10,7 +10,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
@ -335,7 +335,7 @@ func (s *Shard) collectExpiredObjects(ctx context.Context, e Event) {
errGroup.Go(func() error { errGroup.Go(func() error {
batch := make([]oid.Address, 0, batchSize) batch := make([]oid.Address, 0, batchSize)
expErr := s.getExpiredObjects(egCtx, e.(newEpoch).epoch, func(o *meta.ExpiredObject) { expErr := s.getExpiredObjects(egCtx, e.(newEpoch).epoch, func(o *meta.ExpiredObject) {
if o.Type() != object.TypeTombstone && o.Type() != object.TypeLock { if o.Type() != objectSDK.TypeTombstone && o.Type() != objectSDK.TypeLock {
batch = append(batch, o.Address()) batch = append(batch, o.Address())
if len(batch) == batchSize { if len(batch) == batchSize {
@ -519,7 +519,7 @@ func (s *Shard) collectExpiredLocks(ctx context.Context, e Event) {
batch := make([]oid.Address, 0, batchSize) batch := make([]oid.Address, 0, batchSize)
expErr := s.getExpiredObjects(egCtx, e.(newEpoch).epoch, func(o *meta.ExpiredObject) { expErr := s.getExpiredObjects(egCtx, e.(newEpoch).epoch, func(o *meta.ExpiredObject) {
if o.Type() == object.TypeLock { if o.Type() == objectSDK.TypeLock {
batch = append(batch, o.Address()) batch = append(batch, o.Address())
if len(batch) == batchSize { if len(batch) == batchSize {

View file

@ -17,7 +17,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -41,7 +41,7 @@ func Test_ObjectNotFoundIfNotDeletedFromMetabase(t *testing.T) {
blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1)), blobovniczatree.WithBlobovniczaShallowWidth(1)),
Policy: func(_ *object.Object, data []byte) bool { Policy: func(_ *objectSDK.Object, data []byte) bool {
return len(data) <= 1<<20 return len(data) <= 1<<20
}, },
}, },

View file

@ -9,7 +9,7 @@ import (
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
"go.uber.org/zap" "go.uber.org/zap"
@ -87,7 +87,7 @@ func (s *Shard) List(ctx context.Context) (res SelectRes, err error) {
return res, fmt.Errorf("can't list stored containers: %w", err) return res, fmt.Errorf("can't list stored containers: %w", err)
} }
filters := object.NewSearchFilters() filters := objectSDK.NewSearchFilters()
filters.AddPhyFilter() filters.AddPhyFilter()
for i := range lst { for i := range lst {

View file

@ -15,7 +15,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -38,7 +38,7 @@ func TestShard_Lock(t *testing.T) {
blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(2), blobovniczatree.WithBlobovniczaShallowDepth(2),
blobovniczatree.WithBlobovniczaShallowWidth(2)), blobovniczatree.WithBlobovniczaShallowWidth(2)),
Policy: func(_ *object.Object, data []byte) bool { Policy: func(_ *objectSDK.Object, data []byte) bool {
return len(data) <= 1<<20 return len(data) <= 1<<20
}, },
}, },
@ -70,7 +70,7 @@ func TestShard_Lock(t *testing.T) {
objID, _ := obj.ID() objID, _ := obj.ID()
lock := testutil.GenerateObjectWithCID(cnr) lock := testutil.GenerateObjectWithCID(cnr)
lock.SetType(object.TypeLock) lock.SetType(objectSDK.TypeLock)
lockID, _ := lock.ID() lockID, _ := lock.ID()
// put the object // put the object

View file

@ -13,7 +13,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -96,7 +96,7 @@ func TestCounters(t *testing.T) {
require.Equal(t, mode.ReadWrite, mm.mode) require.Equal(t, mode.ReadWrite, mm.mode)
const objNumber = 10 const objNumber = 10
oo := make([]*object.Object, objNumber) oo := make([]*objectSDK.Object, objNumber)
for i := 0; i < objNumber; i++ { for i := 0; i < objNumber; i++ {
oo[i] = testutil.GenerateObject() oo[i] = testutil.GenerateObject()
} }
@ -240,7 +240,7 @@ func shardWithMetrics(t *testing.T, path string) (*shard.Shard, *metricsStore) {
return sh, mm return sh, mm
} }
func addrFromObjs(oo []*object.Object) []oid.Address { func addrFromObjs(oo []*objectSDK.Object) []oid.Address {
aa := make([]oid.Address, len(oo)) aa := make([]oid.Address, len(oo))
for i := 0; i < len(oo); i++ { for i := 0; i < len(oo); i++ {

View file

@ -9,7 +9,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
"go.uber.org/zap" "go.uber.org/zap"
@ -17,14 +17,14 @@ import (
// PutPrm groups the parameters of Put operation. // PutPrm groups the parameters of Put operation.
type PutPrm struct { type PutPrm struct {
obj *object.Object obj *objectSDK.Object
} }
// PutRes groups the resulting values of Put operation. // PutRes groups the resulting values of Put operation.
type PutRes struct{} type PutRes struct{}
// SetObject is a Put option to set object to save. // SetObject is a Put option to set object to save.
func (p *PutPrm) SetObject(obj *object.Object) { func (p *PutPrm) SetObject(obj *objectSDK.Object) {
p.obj = obj p.obj = obj
} }

View file

@ -10,7 +10,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
@ -29,7 +29,7 @@ type RngPrm struct {
// RngRes groups the resulting values of GetRange operation. // RngRes groups the resulting values of GetRange operation.
type RngRes struct { type RngRes struct {
obj *object.Object obj *objectSDK.Object
hasMeta bool hasMeta bool
} }
@ -54,7 +54,7 @@ func (p *RngPrm) SetIgnoreMeta(ignore bool) {
// Object returns the requested object part. // Object returns the requested object part.
// //
// Instance payload contains the requested range of the original object. // Instance payload contains the requested range of the original object.
func (r RngRes) Object() *object.Object { func (r RngRes) Object() *objectSDK.Object {
return r.obj return r.obj
} }
@ -71,7 +71,7 @@ func (r RngRes) HasMeta() bool {
// Returns ErrRangeOutOfBounds if the requested object range is out of bounds. // Returns ErrRangeOutOfBounds if the requested object range is out of bounds.
// Returns an error of type apistatus.ObjectNotFound if the requested object is missing. // Returns an error of type apistatus.ObjectNotFound if the requested object is missing.
// Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. // Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard.
// Returns the object.ErrObjectIsExpired if the object is presented but already expired. // Returns the objectSDK.ErrObjectIsExpired if the object is presented but already expired.
// Returns the ErrShardDisabled if the shard is disabled. // Returns the ErrShardDisabled if the shard is disabled.
func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) { func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) {
ctx, span := tracing.StartSpanFromContext(ctx, "Shard.GetRange", ctx, span := tracing.StartSpanFromContext(ctx, "Shard.GetRange",
@ -91,7 +91,7 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) {
return RngRes{}, ErrShardDisabled return RngRes{}, ErrShardDisabled
} }
cb := func(stor *blobstor.BlobStor, id []byte) (*object.Object, error) { cb := func(stor *blobstor.BlobStor, id []byte) (*objectSDK.Object, error) {
var getRngPrm common.GetRangePrm var getRngPrm common.GetRangePrm
getRngPrm.Address = prm.addr getRngPrm.Address = prm.addr
getRngPrm.Range.SetOffset(prm.off) getRngPrm.Range.SetOffset(prm.off)
@ -103,13 +103,13 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) {
return nil, err return nil, err
} }
obj := object.New() obj := objectSDK.New()
obj.SetPayload(res.Data) obj.SetPayload(res.Data)
return obj, nil return obj, nil
} }
wc := func(c writecache.Cache) (*object.Object, error) { wc := func(c writecache.Cache) (*objectSDK.Object, error) {
res, err := c.Get(ctx, prm.addr) res, err := c.Get(ctx, prm.addr)
if err != nil { if err != nil {
return nil, err return nil, err
@ -122,7 +122,7 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) {
return nil, logicerr.Wrap(apistatus.ObjectOutOfRange{}) return nil, logicerr.Wrap(apistatus.ObjectOutOfRange{})
} }
obj := object.New() obj := objectSDK.New()
obj.SetPayload(payload[from:to]) obj.SetPayload(payload[from:to])
return obj, nil return obj, nil
} }

View file

@ -7,7 +7,7 @@ import (
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
@ -16,7 +16,7 @@ import (
// SelectPrm groups the parameters of Select operation. // SelectPrm groups the parameters of Select operation.
type SelectPrm struct { type SelectPrm struct {
cnr cid.ID cnr cid.ID
filters object.SearchFilters filters objectSDK.SearchFilters
} }
// SelectRes groups the resulting values of Select operation. // SelectRes groups the resulting values of Select operation.
@ -30,7 +30,7 @@ func (p *SelectPrm) SetContainerID(cnr cid.ID) {
} }
// SetFilters is a Select option to set the object filters. // SetFilters is a Select option to set the object filters.
func (p *SelectPrm) SetFilters(fs object.SearchFilters) { func (p *SelectPrm) SetFilters(fs objectSDK.SearchFilters) {
p.filters = fs p.filters = fs
} }

View file

@ -15,7 +15,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -56,7 +56,7 @@ func newCustomShard(t testing.TB, rootPath string, enableWriteCache bool, wcOpts
blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")), blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")),
blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowDepth(1),
blobovniczatree.WithBlobovniczaShallowWidth(1)), blobovniczatree.WithBlobovniczaShallowWidth(1)),
Policy: func(_ *object.Object, data []byte) bool { Policy: func(_ *objectSDK.Object, data []byte) bool {
return len(data) <= 1<<20 return len(data) <= 1<<20
}, },
}, },

View file

@ -1,12 +1,12 @@
package util package util
import ( import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
// MergeSplitInfo ignores conflicts and rewrites `to` with non empty values // MergeSplitInfo ignores conflicts and rewrites `to` with non empty values
// from `from`. // from `from`.
func MergeSplitInfo(from, to *object.SplitInfo) *object.SplitInfo { func MergeSplitInfo(from, to *objectSDK.SplitInfo) *objectSDK.SplitInfo {
to.SetSplitID(from.SplitID()) // overwrite SplitID and ignore conflicts to.SetSplitID(from.SplitID()) // overwrite SplitID and ignore conflicts
if lp, ok := from.LastPart(); ok { if lp, ok := from.LastPart(); ok {

View file

@ -5,7 +5,7 @@ import (
"testing" "testing"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -15,7 +15,7 @@ func TestMergeSplitInfo(t *testing.T) {
uid, err := uuid.NewUUID() uid, err := uuid.NewUUID()
require.NoError(t, err) require.NoError(t, err)
splitID := object.NewSplitID() splitID := objectSDK.NewSplitID()
splitID.SetUUID(uid) splitID.SetUUID(uid)
var rawLinkID, rawLastID [32]byte var rawLinkID, rawLastID [32]byte
@ -30,35 +30,35 @@ func TestMergeSplitInfo(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
lastID.SetSHA256(rawLastID) lastID.SetSHA256(rawLastID)
target := object.NewSplitInfo() // target is SplitInfo struct with all fields set target := objectSDK.NewSplitInfo() // target is SplitInfo struct with all fields set
target.SetSplitID(splitID) target.SetSplitID(splitID)
target.SetLastPart(lastID) target.SetLastPart(lastID)
target.SetLink(linkID) target.SetLink(linkID)
t.Run("merge empty", func(t *testing.T) { t.Run("merge empty", func(t *testing.T) {
to := object.NewSplitInfo() to := objectSDK.NewSplitInfo()
result := util.MergeSplitInfo(target, to) result := util.MergeSplitInfo(target, to)
require.Equal(t, result, target) require.Equal(t, result, target)
}) })
t.Run("merge link", func(t *testing.T) { t.Run("merge link", func(t *testing.T) {
from := object.NewSplitInfo() from := objectSDK.NewSplitInfo()
from.SetSplitID(splitID) from.SetSplitID(splitID)
from.SetLastPart(lastID) from.SetLastPart(lastID)
to := object.NewSplitInfo() to := objectSDK.NewSplitInfo()
to.SetLink(linkID) to.SetLink(linkID)
result := util.MergeSplitInfo(from, to) result := util.MergeSplitInfo(from, to)
require.Equal(t, result, target) require.Equal(t, result, target)
}) })
t.Run("merge last", func(t *testing.T) { t.Run("merge last", func(t *testing.T) {
from := object.NewSplitInfo() from := objectSDK.NewSplitInfo()
from.SetSplitID(splitID) from.SetSplitID(splitID)
from.SetLink(linkID) from.SetLink(linkID)
to := object.NewSplitInfo() to := objectSDK.NewSplitInfo()
to.SetLastPart(lastID) to.SetLastPart(lastID)
result := util.MergeSplitInfo(from, to) result := util.MergeSplitInfo(from, to)

View file

@ -13,7 +13,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"github.com/mr-tron/base58" "github.com/mr-tron/base58"
"github.com/nspcc-dev/neo-go/pkg/util/slice" "github.com/nspcc-dev/neo-go/pkg/util/slice"
@ -129,7 +129,7 @@ func (c *cache) flushSmallObjects() {
var count int var count int
for i := range m { for i := range m {
obj := object.New() obj := objectSDK.New()
if err := obj.Unmarshal(m[i].data); err != nil { if err := obj.Unmarshal(m[i].data); err != nil {
continue continue
} }
@ -201,7 +201,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
return err return err
} }
var obj object.Object var obj objectSDK.Object
err = obj.Unmarshal(data) err = obj.Unmarshal(data)
if err != nil { if err != nil {
c.reportFlushError("can't unmarshal an object", sAddr, metaerr.Wrap(err)) c.reportFlushError("can't unmarshal an object", sAddr, metaerr.Wrap(err))
@ -231,7 +231,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
func (c *cache) workerFlushSmall() { func (c *cache) workerFlushSmall() {
defer c.wg.Done() defer c.wg.Done()
var obj *object.Object var obj *objectSDK.Object
for { for {
// Give priority to direct put. // Give priority to direct put.
select { select {
@ -251,7 +251,7 @@ func (c *cache) workerFlushSmall() {
} }
// flushObject is used to write object directly to the main storage. // flushObject is used to write object directly to the main storage.
func (c *cache) flushObject(ctx context.Context, obj *object.Object, data []byte, st StorageType) error { func (c *cache) flushObject(ctx context.Context, obj *objectSDK.Object, data []byte, st StorageType) error {
var err error var err error
defer func() { defer func() {
@ -322,7 +322,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
return err return err
} }
var obj object.Object var obj objectSDK.Object
if err := obj.Unmarshal(data); err != nil { if err := obj.Unmarshal(data); err != nil {
c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err)) c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err))
if ignoreErrors { if ignoreErrors {

View file

@ -16,7 +16,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
checksumtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum/test" checksumtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum/test"
cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test"
@ -28,7 +28,7 @@ import (
type objectPair struct { type objectPair struct {
addr oid.Address addr oid.Address
obj *object.Object obj *objectSDK.Object
} }
func TestFlush(t *testing.T) { func TestFlush(t *testing.T) {
@ -211,14 +211,14 @@ func putObject(t *testing.T, c Cache, size int) objectPair {
} }
func newObject(t *testing.T, size int) (*object.Object, []byte) { func newObject(t *testing.T, size int) (*objectSDK.Object, []byte) {
obj := object.New() obj := objectSDK.New()
ver := versionSDK.Current() ver := versionSDK.Current()
obj.SetID(oidtest.ID()) obj.SetID(oidtest.ID())
obj.SetOwnerID(usertest.ID()) obj.SetOwnerID(usertest.ID())
obj.SetContainerID(cidtest.ID()) obj.SetContainerID(cidtest.ID())
obj.SetType(object.TypeRegular) obj.SetType(objectSDK.TypeRegular)
obj.SetVersion(&ver) obj.SetVersion(&ver)
obj.SetPayloadChecksum(checksumtest.Checksum()) obj.SetPayloadChecksum(checksumtest.Checksum())
obj.SetPayloadHomomorphicHash(checksumtest.Checksum()) obj.SetPayloadHomomorphicHash(checksumtest.Checksum())

View file

@ -10,7 +10,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.etcd.io/bbolt" "go.etcd.io/bbolt"
"go.uber.org/zap" "go.uber.org/zap"
@ -24,8 +24,8 @@ type Info struct {
// Cache represents write-cache for objects. // Cache represents write-cache for objects.
type Cache interface { type Cache interface {
Get(ctx context.Context, address oid.Address) (*object.Object, error) Get(ctx context.Context, address oid.Address) (*objectSDK.Object, error)
Head(context.Context, oid.Address) (*object.Object, error) Head(context.Context, oid.Address) (*objectSDK.Object, error)
// Delete removes object referenced by the given oid.Address from the // Delete removes object referenced by the given oid.Address from the
// Cache. Returns any error encountered that prevented the object to be // Cache. Returns any error encountered that prevented the object to be
// removed. // removed.
@ -58,7 +58,7 @@ type cache struct {
compressFlags map[string]struct{} compressFlags map[string]struct{}
// flushCh is a channel with objects to flush. // flushCh is a channel with objects to flush.
flushCh chan *object.Object flushCh chan *objectSDK.Object
// closeCh is close channel, protected by modeMtx. // closeCh is close channel, protected by modeMtx.
closeCh chan struct{} closeCh chan struct{}
// wg is a wait group for flush workers. // wg is a wait group for flush workers.
@ -75,7 +75,7 @@ const wcStorageType = "write-cache"
type objectInfo struct { type objectInfo struct {
addr string addr string
data []byte data []byte
obj *object.Object obj *objectSDK.Object
} }
const ( const (
@ -91,7 +91,7 @@ var (
// New creates new writecache instance. // New creates new writecache instance.
func New(opts ...Option) Cache { func New(opts ...Option) Cache {
c := &cache{ c := &cache{
flushCh: make(chan *object.Object), flushCh: make(chan *objectSDK.Object),
mode: mode.ReadWrite, mode: mode.ReadWrite,
compressFlags: make(map[string]struct{}), compressFlags: make(map[string]struct{}),

View file

@ -13,7 +13,7 @@ import (
metrics "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics/grpc" metrics "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics/grpc"
tracing "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing/grpc" tracing "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
@ -166,7 +166,7 @@ func (x *multiClient) iterateClients(ctx context.Context, f func(clientcore.Clie
// non-status logic error that could be returned // non-status logic error that could be returned
// from the SDK client; should not be considered // from the SDK client; should not be considered
// as a connection error // as a connection error
var siErr *object.SplitInfoError var siErr *objectSDK.SplitInfoError
success := err == nil || errors.Is(err, context.Canceled) || errors.As(err, &siErr) success := err == nil || errors.Is(err, context.Canceled) || errors.As(err, &siErr)
if success || firstErr == nil || errors.Is(firstErr, errRecentlyFailed) { if success || firstErr == nil || errors.Is(firstErr, errRecentlyFailed) {
@ -195,7 +195,7 @@ func (x *multiClient) ReportError(err error) {
// non-status logic error that could be returned // non-status logic error that could be returned
// from the SDK client; should not be considered // from the SDK client; should not be considered
// as a connection error // as a connection error
var siErr *object.SplitInfoError var siErr *objectSDK.SplitInfoError
if errors.As(err, &siErr) { if errors.As(err, &siErr) {
return return
} }

View file

@ -10,7 +10,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
eaclSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" eaclSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/crypto/keys"
@ -22,12 +22,12 @@ type testLocalStorage struct {
expAddr oid.Address expAddr oid.Address
obj *object.Object obj *objectSDK.Object
err error err error
} }
func (s *testLocalStorage) Head(ctx context.Context, addr oid.Address) (*object.Object, error) { func (s *testLocalStorage) Head(ctx context.Context, addr oid.Address) (*objectSDK.Object, error) {
require.True(s.t, addr.Container().Equals(s.expAddr.Container())) require.True(s.t, addr.Container().Equals(s.expAddr.Container()))
require.True(s.t, addr.Object().Equals(s.expAddr.Object())) require.True(s.t, addr.Object().Equals(s.expAddr.Object()))
@ -69,11 +69,11 @@ func TestHeadRequest(t *testing.T) {
meta.SetXHeaders(xHdrs) meta.SetXHeaders(xHdrs)
obj := object.New() obj := objectSDK.New()
attrKey := "attr_key" attrKey := "attr_key"
attrVal := "attr_val" attrVal := "attr_val"
var attr object.Attribute var attr objectSDK.Attribute
attr.SetKey(attrKey) attr.SetKey(attrKey)
attr.SetValue(attrVal) attr.SetValue(attrVal)
obj.SetAttributes(attr) obj.SetAttributes(attr)

View file

@ -11,7 +11,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
eaclSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" eaclSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
) )
@ -28,7 +28,7 @@ type cfg struct {
} }
type ObjectStorage interface { type ObjectStorage interface {
Head(context.Context, oid.Address) (*object.Object, error) Head(context.Context, oid.Address) (*objectSDK.Object, error)
} }
type Request interface { type Request interface {
@ -141,7 +141,7 @@ func (h *cfg) readObjectHeadersFromRequestXHeaderSource(m requestXHeaderSource,
oV2.SetObjectID(v.GetObjectID()) oV2.SetObjectID(v.GetObjectID())
oV2.SetHeader(v.GetHeader()) oV2.SetHeader(v.GetHeader())
dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj) dst.objectHeaders = headersFromObject(objectSDK.NewFromV2(oV2), h.cnr, h.obj)
} }
case *objectV2.SearchRequest: case *objectV2.SearchRequest:
cnrV2 := req.GetBody().GetContainerID() cnrV2 := req.GetBody().GetContainerID()
@ -171,7 +171,7 @@ func (h *cfg) readObjectHeadersResponseXHeaderSource(m responseXHeaderSource, ds
oV2.SetObjectID(v.GetObjectID()) oV2.SetObjectID(v.GetObjectID())
oV2.SetHeader(v.GetHeader()) oV2.SetHeader(v.GetHeader())
dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj) dst.objectHeaders = headersFromObject(objectSDK.NewFromV2(oV2), h.cnr, h.obj)
} }
case *objectV2.HeadResponse: case *objectV2.HeadResponse:
oV2 := new(objectV2.Object) oV2 := new(objectV2.Object)
@ -197,7 +197,7 @@ func (h *cfg) readObjectHeadersResponseXHeaderSource(m responseXHeaderSource, ds
oV2.SetHeader(hdr) oV2.SetHeader(hdr)
dst.objectHeaders = headersFromObject(object.NewFromV2(oV2), h.cnr, h.obj) dst.objectHeaders = headersFromObject(objectSDK.NewFromV2(oV2), h.cnr, h.obj)
} }
return nil return nil
} }

View file

@ -6,7 +6,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
eaclSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl" eaclSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -26,7 +26,7 @@ func u64Value(v uint64) string {
return strconv.FormatUint(v, 10) return strconv.FormatUint(v, 10)
} }
func headersFromObject(obj *object.Object, cnr cid.ID, oid *oid.ID) []eaclSDK.Header { func headersFromObject(obj *objectSDK.Object, cnr cid.ID, oid *oid.ID) []eaclSDK.Header {
var count int var count int
for obj := obj; obj != nil; obj = obj.Parent() { for obj := obj; obj != nil; obj = obj.Parent() {
count += 9 + len(obj.Attributes()) count += 9 + len(obj.Attributes())

View file

@ -10,7 +10,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
apiclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" apiclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -29,11 +29,11 @@ type execCtx struct {
log *logger.Logger log *logger.Logger
tombstone *object.Tombstone tombstone *objectSDK.Tombstone
splitInfo *object.SplitInfo splitInfo *objectSDK.SplitInfo
tombstoneObj *object.Object tombstoneObj *objectSDK.Object
} }
const ( const (
@ -241,9 +241,9 @@ func (exec *execCtx) initTombstoneObject() bool {
return false return false
} }
exec.tombstoneObj = object.New() exec.tombstoneObj = objectSDK.New()
exec.tombstoneObj.SetContainerID(exec.containerID()) exec.tombstoneObj.SetContainerID(exec.containerID())
exec.tombstoneObj.SetType(object.TypeTombstone) exec.tombstoneObj.SetType(objectSDK.TypeTombstone)
exec.tombstoneObj.SetPayload(payload) exec.tombstoneObj.SetPayload(payload)
tokenSession := exec.commonParameters().SessionToken() tokenSession := exec.commonParameters().SessionToken()
@ -256,7 +256,7 @@ func (exec *execCtx) initTombstoneObject() bool {
exec.tombstoneObj.SetOwnerID(&localUser) exec.tombstoneObj.SetOwnerID(&localUser)
} }
var a object.Attribute var a objectSDK.Attribute
a.SetKey(objectV2.SysAttributeExpEpoch) a.SetKey(objectV2.SysAttributeExpEpoch)
a.SetValue(strconv.FormatUint(exec.tombstone.ExpirationEpoch(), 10)) a.SetValue(strconv.FormatUint(exec.tombstone.ExpirationEpoch(), 10))

View file

@ -4,7 +4,7 @@ import (
"context" "context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -35,7 +35,7 @@ func (exec *execCtx) formTombstone(ctx context.Context) (ok bool) {
return false return false
} }
exec.tombstone = object.NewTombstone() exec.tombstone = objectSDK.NewTombstone()
exec.tombstone.SetExpirationEpoch( exec.tombstone.SetExpirationEpoch(
exec.svc.netInfo.CurrentEpoch() + tsLifetime, exec.svc.netInfo.CurrentEpoch() + tsLifetime,
) )

View file

@ -9,7 +9,7 @@ import (
searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search" searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"go.uber.org/zap" "go.uber.org/zap"
@ -41,7 +41,7 @@ type cfg struct {
header interface { header interface {
// must return (nil, nil) for PHY objects // must return (nil, nil) for PHY objects
splitInfo(context.Context, *execCtx) (*object.SplitInfo, error) splitInfo(context.Context, *execCtx) (*objectSDK.SplitInfo, error)
children(context.Context, *execCtx) ([]oid.ID, error) children(context.Context, *execCtx) ([]oid.ID, error)
@ -85,7 +85,7 @@ func New(opts ...Option) *Service {
// WithLogger returns option to specify Delete service's logger. // WithLogger returns option to specify Delete service's logger.
func WithLogger(l *logger.Logger) Option { func WithLogger(l *logger.Logger) Option {
return func(c *cfg) { return func(c *cfg) {
c.log = &logger.Logger{Logger: l.With(zap.String("component", "Object.Delete service"))} c.log = &logger.Logger{Logger: l.With(zap.String("component", "objectSDK.Delete service"))}
} }
} }

View file

@ -7,7 +7,7 @@ import (
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
putsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/put" putsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/put"
searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search" searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -21,7 +21,7 @@ type simpleIDWriter struct {
ids []oid.ID ids []oid.ID
} }
func (w *headSvcWrapper) headAddress(ctx context.Context, exec *execCtx, addr oid.Address) (*object.Object, error) { func (w *headSvcWrapper) headAddress(ctx context.Context, exec *execCtx, addr oid.Address) (*objectSDK.Object, error) {
wr := getsvc.NewSimpleObjectWriter() wr := getsvc.NewSimpleObjectWriter()
p := getsvc.HeadPrm{} p := getsvc.HeadPrm{}
@ -38,10 +38,10 @@ func (w *headSvcWrapper) headAddress(ctx context.Context, exec *execCtx, addr oi
return wr.Object(), nil return wr.Object(), nil
} }
func (w *headSvcWrapper) splitInfo(ctx context.Context, exec *execCtx) (*object.SplitInfo, error) { func (w *headSvcWrapper) splitInfo(ctx context.Context, exec *execCtx) (*objectSDK.SplitInfo, error) {
_, err := w.headAddress(ctx, exec, exec.address()) _, err := w.headAddress(ctx, exec, exec.address())
var errSplitInfo *object.SplitInfoError var errSplitInfo *objectSDK.SplitInfoError
switch { switch {
case err == nil: case err == nil:
@ -83,8 +83,8 @@ func (w *headSvcWrapper) previous(ctx context.Context, exec *execCtx, id oid.ID)
} }
func (w *searchSvcWrapper) splitMembers(ctx context.Context, exec *execCtx) ([]oid.ID, error) { func (w *searchSvcWrapper) splitMembers(ctx context.Context, exec *execCtx) ([]oid.ID, error) {
fs := object.SearchFilters{} fs := objectSDK.SearchFilters{}
fs.AddSplitIDFilter(object.MatchStringEqual, exec.splitInfo.SplitID()) fs.AddSplitIDFilter(objectSDK.MatchStringEqual, exec.splitInfo.SplitID())
wr := new(simpleIDWriter) wr := new(simpleIDWriter)

View file

@ -5,7 +5,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -74,7 +74,7 @@ func (s *Service) get(ctx context.Context, prm RequestParameters) error {
localStorage: s.localStorage, localStorage: s.localStorage,
prm: prm, prm: prm,
infoSplit: object.NewSplitInfo(), infoSplit: objectSDK.NewSplitInfo(),
} }
exec.setLogger(s.log) exec.setLogger(s.log)

View file

@ -17,7 +17,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal"
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
) )
@ -31,7 +31,7 @@ type getRequestForwarder struct {
Stream *streamObjectWriter Stream *streamObjectWriter
} }
func (f *getRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*object.Object, error) { func (f *getRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*objectSDK.Object, error) {
ctx, span := tracing.StartSpanFromContext(ctx, "getRequestForwarder.forwardRequestToNode", ctx, span := tracing.StartSpanFromContext(ctx, "getRequestForwarder.forwardRequestToNode",
trace.WithAttributes(attribute.String("address", addr.String())), trace.WithAttributes(attribute.String("address", addr.String())),
) )
@ -85,7 +85,7 @@ func (f *getRequestForwarder) writeHeader(ctx context.Context, v *objectV2.GetOb
var err error var err error
f.OnceHeaderSending.Do(func() { f.OnceHeaderSending.Do(func() {
err = f.Stream.WriteHeader(ctx, object.NewFromV2(obj)) err = f.Stream.WriteHeader(ctx, objectSDK.NewFromV2(obj))
}) })
if err != nil { if err != nil {
return errCouldNotWriteObjHeader(err) return errCouldNotWriteObjHeader(err)
@ -164,8 +164,8 @@ func (f *getRequestForwarder) readStream(ctx context.Context, c client.MultiAddr
localProgress += len(origChunk) localProgress += len(origChunk)
f.GlobalProgress += len(chunk) f.GlobalProgress += len(chunk)
case *objectV2.SplitInfo: case *objectV2.SplitInfo:
si := object.NewSplitInfoFromV2(v) si := objectSDK.NewSplitInfoFromV2(v)
return object.NewSplitInfoError(si) return objectSDK.NewSplitInfoError(si)
} }
} }
return nil return nil

View file

@ -17,7 +17,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal"
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
) )
@ -30,7 +30,7 @@ type getRangeRequestForwarder struct {
Stream *streamObjectRangeWriter Stream *streamObjectRangeWriter
} }
func (f *getRangeRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*object.Object, error) { func (f *getRangeRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*objectSDK.Object, error) {
ctx, span := tracing.StartSpanFromContext(ctx, "getRangeRequestForwarder.forwardRequestToNode", ctx, span := tracing.StartSpanFromContext(ctx, "getRangeRequestForwarder.forwardRequestToNode",
trace.WithAttributes(attribute.String("address", addr.String())), trace.WithAttributes(attribute.String("address", addr.String())),
) )
@ -130,8 +130,8 @@ func (f *getRangeRequestForwarder) readStream(ctx context.Context, rangeStream *
localProgress += len(origChunk) localProgress += len(origChunk)
f.GlobalProgress += len(chunk) f.GlobalProgress += len(chunk)
case *objectV2.SplitInfo: case *objectV2.SplitInfo:
si := object.NewSplitInfoFromV2(v) si := objectSDK.NewSplitInfoFromV2(v)
return object.NewSplitInfoError(si) return objectSDK.NewSplitInfoError(si)
} }
} }
return nil return nil

View file

@ -16,7 +16,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal"
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto" frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace"
@ -30,7 +30,7 @@ type headRequestForwarder struct {
Key *ecdsa.PrivateKey Key *ecdsa.PrivateKey
} }
func (f *headRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*object.Object, error) { func (f *headRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*objectSDK.Object, error) {
ctx, span := tracing.StartSpanFromContext(ctx, "headRequestForwarder.forwardRequestToNode", ctx, span := tracing.StartSpanFromContext(ctx, "headRequestForwarder.forwardRequestToNode",
trace.WithAttributes(attribute.String("address", addr.String())), trace.WithAttributes(attribute.String("address", addr.String())),
) )
@ -82,15 +82,15 @@ func (f *headRequestForwarder) forwardRequestToNode(ctx context.Context, addr ne
return nil, err return nil, err
} }
case *objectV2.SplitInfo: case *objectV2.SplitInfo:
si := object.NewSplitInfoFromV2(v) si := objectSDK.NewSplitInfoFromV2(v)
return nil, object.NewSplitInfoError(si) return nil, objectSDK.NewSplitInfoError(si)
} }
objv2 := new(objectV2.Object) objv2 := new(objectV2.Object)
objv2.SetHeader(hdr) objv2.SetHeader(hdr)
objv2.SetSignature(idSig) objv2.SetSignature(idSig)
obj := object.NewFromV2(objv2) obj := objectSDK.NewFromV2(objv2)
obj.SetID(f.ObjectAddr.Object()) obj.SetID(f.ObjectAddr.Object())
return obj, nil return obj, nil

View file

@ -8,7 +8,7 @@ import (
objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object" objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
objutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" objutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
// Service implements Get operation of Object service v2. // Service implements Get operation of Object service v2.
@ -47,7 +47,7 @@ func (s *Service) Get(req *objectV2.GetRequest, stream objectSvc.GetObjectStream
err = s.svc.Get(stream.Context(), *p) err = s.svc.Get(stream.Context(), *p)
var splitErr *object.SplitInfoError var splitErr *objectSDK.SplitInfoError
switch { switch {
case errors.As(err, &splitErr): case errors.As(err, &splitErr):
@ -66,7 +66,7 @@ func (s *Service) GetRange(req *objectV2.GetRangeRequest, stream objectSvc.GetOb
err = s.svc.GetRange(stream.Context(), *p) err = s.svc.GetRange(stream.Context(), *p)
var splitErr *object.SplitInfoError var splitErr *objectSDK.SplitInfoError
switch { switch {
case errors.As(err, &splitErr): case errors.As(err, &splitErr):
@ -103,7 +103,7 @@ func (s *Service) Head(ctx context.Context, req *objectV2.HeadRequest) (*objectV
err = s.svc.Head(ctx, *p) err = s.svc.Head(ctx, *p)
var splitErr *object.SplitInfoError var splitErr *objectSDK.SplitInfoError
if errors.As(err, &splitErr) { if errors.As(err, &splitErr) {
setSplitInfoHeadResponse(splitErr.SplitInfo(), resp) setSplitInfoHeadResponse(splitErr.SplitInfo(), resp)

View file

@ -5,7 +5,7 @@ import (
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object" objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
type streamObjectWriter struct { type streamObjectWriter struct {
@ -16,7 +16,7 @@ type streamObjectRangeWriter struct {
objectSvc.GetObjectRangeStream objectSvc.GetObjectRangeStream
} }
func (s *streamObjectWriter) WriteHeader(_ context.Context, obj *object.Object) error { func (s *streamObjectWriter) WriteHeader(_ context.Context, obj *objectSDK.Object) error {
p := new(objectV2.GetObjectPartInit) p := new(objectV2.GetObjectPartInit)
objV2 := obj.ToV2() objV2 := obj.ToV2()

View file

@ -16,7 +16,7 @@ import (
getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
versionSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" versionSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
"git.frostfs.info/TrueCloudLab/tzhash/tz" "git.frostfs.info/TrueCloudLab/tzhash/tz"
@ -98,7 +98,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get
p.WithAddress(addr) p.WithAddress(addr)
p.WithRawFlag(body.GetRaw()) p.WithRawFlag(body.GetRaw())
p.SetChunkWriter(streamWrapper) p.SetChunkWriter(streamWrapper)
p.SetRange(object.NewRangeFromV2(body.GetRange())) p.SetRange(objectSDK.NewRangeFromV2(body.GetRange()))
err = p.Validate() err = p.Validate()
if err != nil { if err != nil {
@ -167,10 +167,10 @@ func (s *Service) toHashRangePrm(req *objectV2.GetRangeHashRequest) (*getsvc.Ran
} }
rngsV2 := body.GetRanges() rngsV2 := body.GetRanges()
rngs := make([]object.Range, len(rngsV2)) rngs := make([]objectSDK.Range, len(rngsV2))
for i := range rngsV2 { for i := range rngsV2 {
rngs[i] = *object.NewRangeFromV2(&rngsV2[i]) rngs[i] = *objectSDK.NewRangeFromV2(&rngsV2[i])
} }
p.SetRangeList(rngs) p.SetRangeList(rngs)
@ -198,7 +198,7 @@ type headResponseWriter struct {
body *objectV2.HeadResponseBody body *objectV2.HeadResponseBody
} }
func (w *headResponseWriter) WriteHeader(_ context.Context, hdr *object.Object) error { func (w *headResponseWriter) WriteHeader(_ context.Context, hdr *objectSDK.Object) error {
if w.mainOnly { if w.mainOnly {
w.body.SetHeaderPart(toShortObjectHeader(hdr)) w.body.SetHeaderPart(toShortObjectHeader(hdr))
} else { } else {
@ -259,7 +259,7 @@ func (s *Service) toHeadPrm(req *objectV2.HeadRequest, resp *objectV2.HeadRespon
return p, nil return p, nil
} }
func splitInfoResponse(info *object.SplitInfo) *objectV2.GetResponse { func splitInfoResponse(info *objectSDK.SplitInfo) *objectV2.GetResponse {
resp := new(objectV2.GetResponse) resp := new(objectV2.GetResponse)
body := new(objectV2.GetResponseBody) body := new(objectV2.GetResponseBody)
@ -270,7 +270,7 @@ func splitInfoResponse(info *object.SplitInfo) *objectV2.GetResponse {
return resp return resp
} }
func splitInfoRangeResponse(info *object.SplitInfo) *objectV2.GetRangeResponse { func splitInfoRangeResponse(info *objectSDK.SplitInfo) *objectV2.GetRangeResponse {
resp := new(objectV2.GetRangeResponse) resp := new(objectV2.GetRangeResponse)
body := new(objectV2.GetRangeResponseBody) body := new(objectV2.GetRangeResponseBody)
@ -281,7 +281,7 @@ func splitInfoRangeResponse(info *object.SplitInfo) *objectV2.GetRangeResponse {
return resp return resp
} }
func setSplitInfoHeadResponse(info *object.SplitInfo, resp *objectV2.HeadResponse) { func setSplitInfoHeadResponse(info *objectSDK.SplitInfo, resp *objectV2.HeadResponse) {
resp.GetBody().SetHeaderPart(info.ToV2()) resp.GetBody().SetHeaderPart(info.ToV2())
} }
@ -297,7 +297,7 @@ func toHashResponse(typ refs.ChecksumType, res *getsvc.RangeHashRes) *objectV2.G
return resp return resp
} }
func toFullObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { func toFullObjectHeader(hdr *objectSDK.Object) objectV2.GetHeaderPart {
obj := hdr.ToV2() obj := hdr.ToV2()
hs := new(objectV2.HeaderWithSignature) hs := new(objectV2.HeaderWithSignature)
@ -307,7 +307,7 @@ func toFullObjectHeader(hdr *object.Object) objectV2.GetHeaderPart {
return hs return hs
} }
func toShortObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { func toShortObjectHeader(hdr *objectSDK.Object) objectV2.GetHeaderPart {
hdrV2 := hdr.ToV2().GetHeader() hdrV2 := hdr.ToV2().GetHeader()
sh := new(objectV2.ShortHeader) sh := new(objectV2.ShortHeader)
@ -322,11 +322,11 @@ func toShortObjectHeader(hdr *object.Object) objectV2.GetHeaderPart {
return sh return sh
} }
func groupAddressRequestForwarder(f func(context.Context, network.Address, client.MultiAddressClient, []byte) (*object.Object, error)) getsvc.RequestForwarder { func groupAddressRequestForwarder(f func(context.Context, network.Address, client.MultiAddressClient, []byte) (*objectSDK.Object, error)) getsvc.RequestForwarder {
return func(ctx context.Context, info client.NodeInfo, c client.MultiAddressClient) (*object.Object, error) { return func(ctx context.Context, info client.NodeInfo, c client.MultiAddressClient) (*objectSDK.Object, error) {
var ( var (
firstErr error firstErr error
res *object.Object res *objectSDK.Object
key = info.PublicKey() key = info.PublicKey()
) )

View file

@ -4,7 +4,7 @@ import (
"context" "context"
"io" "io"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
// ChunkWriter is an interface of target component // ChunkWriter is an interface of target component
@ -16,7 +16,7 @@ type ChunkWriter interface {
// HeaderWriter is an interface of target component // HeaderWriter is an interface of target component
// to write object header. // to write object header.
type HeaderWriter interface { type HeaderWriter interface {
WriteHeader(context.Context, *object.Object) error WriteHeader(context.Context, *objectSDK.Object) error
} }
// ObjectWriter is an interface of target component to write object. // ObjectWriter is an interface of target component to write object.
@ -26,7 +26,7 @@ type ObjectWriter interface {
} }
type SimpleObjectWriter struct { type SimpleObjectWriter struct {
obj *object.Object obj *objectSDK.Object
pld []byte pld []byte
} }
@ -45,11 +45,11 @@ type hasherWrapper struct {
func NewSimpleObjectWriter() *SimpleObjectWriter { func NewSimpleObjectWriter() *SimpleObjectWriter {
return &SimpleObjectWriter{ return &SimpleObjectWriter{
obj: object.New(), obj: objectSDK.New(),
} }
} }
func (s *SimpleObjectWriter) WriteHeader(_ context.Context, obj *object.Object) error { func (s *SimpleObjectWriter) WriteHeader(_ context.Context, obj *objectSDK.Object) error {
s.obj = obj s.obj = obj
s.pld = make([]byte, 0, obj.PayloadSize()) s.pld = make([]byte, 0, obj.PayloadSize())
@ -62,7 +62,7 @@ func (s *SimpleObjectWriter) WriteChunk(_ context.Context, p []byte) error {
return nil return nil
} }
func (s *SimpleObjectWriter) Object() *object.Object { func (s *SimpleObjectWriter) Object() *objectSDK.Object {
if len(s.pld) > 0 { if len(s.pld) > 0 {
s.obj.SetPayload(s.pld) s.obj.SetPayload(s.pld)
} }
@ -74,7 +74,7 @@ func (w *partWriter) WriteChunk(ctx context.Context, p []byte) error {
return w.chunkWriter.WriteChunk(ctx, p) return w.chunkWriter.WriteChunk(ctx, p)
} }
func (w *partWriter) WriteHeader(ctx context.Context, o *object.Object) error { func (w *partWriter) WriteHeader(ctx context.Context, o *objectSDK.Object) error {
return w.headWriter.WriteHeader(ctx, o) return w.headWriter.WriteHeader(ctx, o)
} }

View file

@ -10,7 +10,7 @@ import (
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -64,7 +64,7 @@ func (p *RemoteHeadPrm) WithObjectAddress(v oid.Address) *RemoteHeadPrm {
} }
// Head requests object header from the remote node. // Head requests object header from the remote node.
func (h *RemoteHeader) Head(ctx context.Context, prm *RemoteHeadPrm) (*object.Object, error) { func (h *RemoteHeader) Head(ctx context.Context, prm *RemoteHeadPrm) (*objectSDK.Object, error) {
key, err := h.keyStorage.GetKey(nil) key, err := h.keyStorage.GetKey(nil)
if err != nil { if err != nil {
return nil, fmt.Errorf("(%T) could not receive private key: %w", h, err) return nil, fmt.Errorf("(%T) could not receive private key: %w", h, err)

View file

@ -14,7 +14,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
) )
@ -77,7 +77,7 @@ type readPrmCommon struct {
commonPrm commonPrm
} }
// SetNetmapEpoch sets the epoch number to be used to locate the object. // SetNetmapEpoch sets the epoch number to be used to locate the objectSDK.
// //
// By default current epoch on the server will be used. // By default current epoch on the server will be used.
func (x *readPrmCommon) SetNetmapEpoch(_ uint64) { func (x *readPrmCommon) SetNetmapEpoch(_ uint64) {
@ -111,11 +111,11 @@ func (x *GetObjectPrm) SetAddress(addr oid.Address) {
// GetObjectRes groups the resulting values of GetObject operation. // GetObjectRes groups the resulting values of GetObject operation.
type GetObjectRes struct { type GetObjectRes struct {
obj *object.Object obj *objectSDK.Object
} }
// Object returns requested object. // Object returns requested objectSDK.
func (x GetObjectRes) Object() *object.Object { func (x GetObjectRes) Object() *objectSDK.Object {
return x.obj return x.obj
} }
@ -125,10 +125,10 @@ func (x GetObjectRes) Object() *object.Object {
// //
// Returns any error which prevented the operation from completing correctly in error return. // Returns any error which prevented the operation from completing correctly in error return.
// Returns: // Returns:
// - error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; // - error of type *objectSDK.SplitInfoError if object raw flag is set and requested object is virtual;
// - error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. // - error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
// //
// GetObject ignores the provided session if it is not related to the requested object. // GetObject ignores the provided session if it is not related to the requested objectSDK.
func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) { func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
// here we ignore session if it is opened for other object since such // here we ignore session if it is opened for other object since such
// request will almost definitely fail. The case can occur, for example, // request will almost definitely fail. The case can occur, for example,
@ -155,7 +155,7 @@ func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
return nil, fmt.Errorf("init object reading: %w", err) return nil, fmt.Errorf("init object reading: %w", err)
} }
var obj object.Object var obj objectSDK.Object
if !rdr.ReadHeader(&obj) { if !rdr.ReadHeader(&obj) {
res, err := rdr.Close() res, err := rdr.Close()
@ -210,11 +210,11 @@ func (x *HeadObjectPrm) SetAddress(addr oid.Address) {
// HeadObjectRes groups the resulting values of GetObject operation. // HeadObjectRes groups the resulting values of GetObject operation.
type HeadObjectRes struct { type HeadObjectRes struct {
hdr *object.Object hdr *objectSDK.Object
} }
// Header returns requested object header. // Header returns requested object header.
func (x HeadObjectRes) Header() *object.Object { func (x HeadObjectRes) Header() *objectSDK.Object {
return x.hdr return x.hdr
} }
@ -225,10 +225,10 @@ func (x HeadObjectRes) Header() *object.Object {
// Returns any error which prevented the operation from completing correctly in error return. // Returns any error which prevented the operation from completing correctly in error return.
// Returns: // Returns:
// //
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; // error of type *objectSDK.SplitInfoError if object raw flag is set and requested object is virtual;
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed. // error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed.
// //
// HeadObject ignores the provided session if it is not related to the requested object. // HeadObject ignores the provided session if it is not related to the requested objectSDK.
func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error) { func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error) {
if prm.local { if prm.local {
prm.cliPrm.MarkLocal() prm.cliPrm.MarkLocal()
@ -255,7 +255,7 @@ func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error)
return nil, fmt.Errorf("read object header from FrostFS: %w", err) return nil, fmt.Errorf("read object header from FrostFS: %w", err)
} }
var hdr object.Object var hdr objectSDK.Object
if !cliRes.ReadHeader(&hdr) { if !cliRes.ReadHeader(&hdr) {
return nil, errors.New("missing object header in the response") return nil, errors.New("missing object header in the response")
@ -296,7 +296,7 @@ func (x *PayloadRangePrm) SetAddress(addr oid.Address) {
// SetRange range of the object payload to be read. // SetRange range of the object payload to be read.
// //
// Required parameter. // Required parameter.
func (x *PayloadRangePrm) SetRange(rng *object.Range) { func (x *PayloadRangePrm) SetRange(rng *objectSDK.Range) {
x.cliPrm.SetOffset(rng.GetOffset()) x.cliPrm.SetOffset(rng.GetOffset())
x.ln = rng.GetLength() x.ln = rng.GetLength()
} }
@ -323,11 +323,11 @@ const maxInitialBufferSize = 1024 * 1024 // 1 MiB
// Returns any error which prevented the operation from completing correctly in error return. // Returns any error which prevented the operation from completing correctly in error return.
// Returns: // Returns:
// //
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual; // error of type *objectSDK.SplitInfoError if object raw flag is set and requested object is virtual;
// error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed; // error of type *apistatus.ObjectAlreadyRemoved if the requested object is marked to be removed;
// error of type *apistatus.ObjectOutOfRange if the requested range is too big. // error of type *apistatus.ObjectOutOfRange if the requested range is too big.
// //
// PayloadRange ignores the provided session if it is not related to the requested object. // PayloadRange ignores the provided session if it is not related to the requested objectSDK.
func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, error) { func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, error) {
if prm.local { if prm.local {
prm.cliPrm.MarkLocal() prm.cliPrm.MarkLocal()
@ -377,13 +377,13 @@ func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, e
type PutObjectPrm struct { type PutObjectPrm struct {
commonPrm commonPrm
obj *object.Object obj *objectSDK.Object
} }
// SetObject sets object to be stored. // SetObject sets object to be stored.
// //
// Required parameter. // Required parameter.
func (x *PutObjectPrm) SetObject(obj *object.Object) { func (x *PutObjectPrm) SetObject(obj *objectSDK.Object) {
x.obj = obj x.obj = obj
} }
@ -392,7 +392,7 @@ type PutObjectRes struct {
id oid.ID id oid.ID
} }
// ID returns identifier of the stored object. // ID returns identifier of the stored objectSDK.
func (x PutObjectRes) ID() oid.ID { func (x PutObjectRes) ID() oid.ID {
return x.id return x.id
} }
@ -464,7 +464,7 @@ func (x *SearchObjectsPrm) SetContainerID(id cid.ID) {
} }
// SetFilters sets search filters. // SetFilters sets search filters.
func (x *SearchObjectsPrm) SetFilters(fs object.SearchFilters) { func (x *SearchObjectsPrm) SetFilters(fs objectSDK.SearchFilters) {
x.cliPrm.SetFilters(fs) x.cliPrm.SetFilters(fs)
} }

View file

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" objectCore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
) )
@ -14,7 +14,7 @@ import (
type ObjectStorage interface { type ObjectStorage interface {
// Put must save passed object // Put must save passed object
// and return any appeared error. // and return any appeared error.
Put(context.Context, *object.Object) error Put(context.Context, *objectSDK.Object) error
// Delete must delete passed objects // Delete must delete passed objects
// and return any appeared error. // and return any appeared error.
Delete(ctx context.Context, tombstone oid.Address, toDelete []oid.ID) error Delete(ctx context.Context, tombstone oid.Address, toDelete []oid.ID) error
@ -28,11 +28,11 @@ type ObjectStorage interface {
type localTarget struct { type localTarget struct {
storage ObjectStorage storage ObjectStorage
obj *object.Object obj *objectSDK.Object
meta objectCore.ContentMeta meta objectCore.ContentMeta
} }
func (t *localTarget) WriteObject(obj *object.Object, meta objectCore.ContentMeta) error { func (t *localTarget) WriteObject(obj *objectSDK.Object, meta objectCore.ContentMeta) error {
t.obj = obj t.obj = obj
t.meta = meta t.meta = meta
@ -41,12 +41,12 @@ func (t *localTarget) WriteObject(obj *object.Object, meta objectCore.ContentMet
func (t *localTarget) Close(ctx context.Context) (*transformer.AccessIdentifiers, error) { func (t *localTarget) Close(ctx context.Context) (*transformer.AccessIdentifiers, error) {
switch t.meta.Type() { switch t.meta.Type() {
case object.TypeTombstone: case objectSDK.TypeTombstone:
err := t.storage.Delete(ctx, objectCore.AddressOf(t.obj), t.meta.Objects()) err := t.storage.Delete(ctx, objectCore.AddressOf(t.obj), t.meta.Objects())
if err != nil { if err != nil {
return nil, fmt.Errorf("could not delete objects from tombstone locally: %w", err) return nil, fmt.Errorf("could not delete objects from tombstone locally: %w", err)
} }
case object.TypeLock: case objectSDK.TypeLock:
err := t.storage.Lock(ctx, objectCore.AddressOf(t.obj), t.meta.Objects()) err := t.storage.Lock(ctx, objectCore.AddressOf(t.obj), t.meta.Objects())
if err != nil { if err != nil {
return nil, fmt.Errorf("could not lock object from lock objects locally: %w", err) return nil, fmt.Errorf("could not lock object from lock objects locally: %w", err)

View file

@ -7,13 +7,13 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
type PutInitPrm struct { type PutInitPrm struct {
common *util.CommonPrm common *util.CommonPrm
hdr *object.Object hdr *objectSDK.Object
cnr containerSDK.Container cnr containerSDK.Container
@ -34,7 +34,7 @@ func (p *PutInitPrm) WithCommonPrm(v *util.CommonPrm) *PutInitPrm {
return p return p
} }
func (p *PutInitPrm) WithObject(v *object.Object) *PutInitPrm { func (p *PutInitPrm) WithObject(v *objectSDK.Object) *PutInitPrm {
if p != nil { if p != nil {
p.hdr = v p.hdr = v
} }

View file

@ -11,7 +11,7 @@ import (
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
) )
@ -22,7 +22,7 @@ type remoteTarget struct {
nodeInfo clientcore.NodeInfo nodeInfo clientcore.NodeInfo
obj *object.Object obj *objectSDK.Object
clientConstructor ClientConstructor clientConstructor ClientConstructor
} }
@ -39,10 +39,10 @@ type RemoteSender struct {
type RemotePutPrm struct { type RemotePutPrm struct {
node netmap.NodeInfo node netmap.NodeInfo
obj *object.Object obj *objectSDK.Object
} }
func (t *remoteTarget) WriteObject(obj *object.Object, _ objectcore.ContentMeta) error { func (t *remoteTarget) WriteObject(obj *objectSDK.Object, _ objectcore.ContentMeta) error {
t.obj = obj t.obj = obj
return nil return nil
@ -89,7 +89,7 @@ func (p *RemotePutPrm) WithNodeInfo(v netmap.NodeInfo) *RemotePutPrm {
} }
// WithObject sets transferred object. // WithObject sets transferred object.
func (p *RemotePutPrm) WithObject(v *object.Object) *RemotePutPrm { func (p *RemotePutPrm) WithObject(v *objectSDK.Object) *RemotePutPrm {
if p != nil { if p != nil {
p.obj = v p.obj = v
} }

View file

@ -12,7 +12,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
pkgutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" pkgutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" containerSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
) )
@ -212,7 +212,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
// enable additional container broadcast on non-local operation // enable additional container broadcast on non-local operation
// if object has TOMBSTONE or LOCK type. // if object has TOMBSTONE or LOCK type.
typ := prm.hdr.Type() typ := prm.hdr.Type()
withBroadcast := !prm.common.LocalOnly() && (typ == object.TypeTombstone || typ == object.TypeLock) withBroadcast := !prm.common.LocalOnly() && (typ == objectSDK.TypeTombstone || typ == objectSDK.TypeLock)
return &distributedTarget{ return &distributedTarget{
traversal: traversal{ traversal: traversal{

View file

@ -5,7 +5,7 @@ import (
refsV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" refsV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
putsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/put" putsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/put"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
) )
func (s *streamer) toInitPrm(part *objectV2.PutObjectPartInit, req *objectV2.PutRequest) (*putsvc.PutInitPrm, error) { func (s *streamer) toInitPrm(part *objectV2.PutObjectPartInit, req *objectV2.PutRequest) (*putsvc.PutInitPrm, error) {
@ -21,7 +21,7 @@ func (s *streamer) toInitPrm(part *objectV2.PutObjectPartInit, req *objectV2.Put
return new(putsvc.PutInitPrm). return new(putsvc.PutInitPrm).
WithObject( WithObject(
object.NewFromV2(oV2), objectSDK.NewFromV2(oV2),
). ).
WithRelay(s.relayRequest). WithRelay(s.relayRequest).
WithCommonPrm(commonPrm). WithCommonPrm(commonPrm).

View file

@ -5,7 +5,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -56,7 +56,7 @@ func (exec *execCtx) containerID() cid.ID {
return exec.prm.cnr return exec.prm.cnr
} }
func (exec *execCtx) searchFilters() object.SearchFilters { func (exec *execCtx) searchFilters() objectSDK.SearchFilters {
return exec.prm.filters return exec.prm.filters
} }

View file

@ -6,7 +6,7 @@ import (
coreclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client" coreclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -18,7 +18,7 @@ type Prm struct {
cnr cid.ID cnr cid.ID
filters object.SearchFilters filters objectSDK.SearchFilters
forwarder RequestForwarder forwarder RequestForwarder
} }
@ -55,6 +55,6 @@ func (p *Prm) WithContainerID(id cid.ID) {
} }
// WithSearchFilters sets search filters. // WithSearchFilters sets search filters.
func (p *Prm) WithSearchFilters(fs object.SearchFilters) { func (p *Prm) WithSearchFilters(fs objectSDK.SearchFilters) {
p.filters = fs p.filters = fs
} }

View file

@ -12,7 +12,7 @@ import (
searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search" searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -58,7 +58,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre
} }
p.WithContainerID(id) p.WithContainerID(id)
p.WithSearchFilters(object.NewSearchFiltersFromV2(body.GetFilters())) p.WithSearchFilters(objectSDK.NewSearchFiltersFromV2(body.GetFilters()))
return p, nil return p, nil
} }

View file

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
@ -22,11 +22,11 @@ type HeadReceiver interface {
// //
// If reverseDirection arg is true, then the traversal is done in reverse order. // If reverseDirection arg is true, then the traversal is done in reverse order.
// Stop boolean result provides the ability to interrupt the traversal. // Stop boolean result provides the ability to interrupt the traversal.
type SplitMemberHandler func(member *object.Object, reverseDirection bool) (stop bool) type SplitMemberHandler func(member *objectSDK.Object, reverseDirection bool) (stop bool)
// IterateAllSplitLeaves is an iterator over all object split-tree leaves in direct order. // IterateAllSplitLeaves is an iterator over all object split-tree leaves in direct order.
func IterateAllSplitLeaves(r HeadReceiver, addr oid.Address, h func(*object.Object)) error { func IterateAllSplitLeaves(r HeadReceiver, addr oid.Address, h func(*objectSDK.Object)) error {
return IterateSplitLeaves(r, addr, func(leaf *object.Object) bool { return IterateSplitLeaves(r, addr, func(leaf *objectSDK.Object) bool {
h(leaf) h(leaf)
return false return false
}) })
@ -35,13 +35,13 @@ func IterateAllSplitLeaves(r HeadReceiver, addr oid.Address, h func(*object.Obje
// IterateSplitLeaves is an iterator over object split-tree leaves in direct order. // IterateSplitLeaves is an iterator over object split-tree leaves in direct order.
// //
// If member handler returns true, then the iterator aborts without error. // If member handler returns true, then the iterator aborts without error.
func IterateSplitLeaves(r HeadReceiver, addr oid.Address, h func(*object.Object) bool) error { func IterateSplitLeaves(r HeadReceiver, addr oid.Address, h func(*objectSDK.Object) bool) error {
var ( var (
reverse bool reverse bool
leaves []*object.Object leaves []*objectSDK.Object
) )
if err := TraverseSplitChain(r, addr, func(member *object.Object, reverseDirection bool) (stop bool) { if err := TraverseSplitChain(r, addr, func(member *objectSDK.Object, reverseDirection bool) (stop bool) {
reverse = reverseDirection reverse = reverseDirection
if reverse { if reverse {
@ -84,9 +84,9 @@ func traverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler)
switch res := v.(type) { switch res := v.(type) {
default: default:
panic(fmt.Sprintf("unexpected result of %T: %T", r, v)) panic(fmt.Sprintf("unexpected result of %T: %T", r, v))
case *object.Object: case *objectSDK.Object:
return h(res, false), nil return h(res, false), nil
case *object.SplitInfo: case *objectSDK.SplitInfo:
link, withLink := res.Link() link, withLink := res.Link()
last, withLast := res.LastPart() last, withLast := res.LastPart()
@ -108,7 +108,7 @@ func traverseByLink(cnr cid.ID, link oid.ID, r HeadReceiver, h SplitMemberHandle
chain := make([]oid.ID, 0) chain := make([]oid.ID, 0)
if _, err := traverseSplitChain(r, addr, func(member *object.Object, reverseDirection bool) (stop bool) { if _, err := traverseSplitChain(r, addr, func(member *objectSDK.Object, reverseDirection bool) (stop bool) {
children := member.Children() children := member.Children()
if reverseDirection { if reverseDirection {
@ -122,12 +122,12 @@ func traverseByLink(cnr cid.ID, link oid.ID, r HeadReceiver, h SplitMemberHandle
return false, err return false, err
} }
var reverseChain []*object.Object var reverseChain []*objectSDK.Object
for i := range chain { for i := range chain {
addr.SetObject(chain[i]) addr.SetObject(chain[i])
if stop, err := traverseSplitChain(r, addr, func(member *object.Object, reverseDirection bool) (stop bool) { if stop, err := traverseSplitChain(r, addr, func(member *objectSDK.Object, reverseDirection bool) (stop bool) {
if !reverseDirection { if !reverseDirection {
return h(member, false) return h(member, false)
} }
@ -147,16 +147,16 @@ func traverseByLink(cnr cid.ID, link oid.ID, r HeadReceiver, h SplitMemberHandle
return false, nil return false, nil
} }
func traverseByLast(cnr cid.ID, last oid.ID, withLast bool, res *object.SplitInfo, r HeadReceiver, h SplitMemberHandler) (bool, error) { func traverseByLast(cnr cid.ID, last oid.ID, withLast bool, res *objectSDK.SplitInfo, r HeadReceiver, h SplitMemberHandler) (bool, error) {
var addr oid.Address var addr oid.Address
addr.SetContainer(cnr) addr.SetContainer(cnr)
for last, withLast = res.LastPart(); withLast; { for last, withLast = res.LastPart(); withLast; {
addr.SetObject(last) addr.SetObject(last)
var directChain []*object.Object var directChain []*objectSDK.Object
if _, err := traverseSplitChain(r, addr, func(member *object.Object, reverseDirection bool) (stop bool) { if _, err := traverseSplitChain(r, addr, func(member *objectSDK.Object, reverseDirection bool) (stop bool) {
if reverseDirection { if reverseDirection {
last, withLast = member.PreviousID() last, withLast = member.PreviousID()
return h(member, true) return h(member, true)

View file

@ -7,7 +7,7 @@ import (
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
lru "github.com/hashicorp/golang-lru/v2" lru "github.com/hashicorp/golang-lru/v2"
"go.uber.org/zap" "go.uber.org/zap"
@ -21,7 +21,7 @@ type Source interface {
// //
// Tombstone MUST return (nil, nil) if requested tombstone is // Tombstone MUST return (nil, nil) if requested tombstone is
// missing in the storage for the provided epoch. // missing in the storage for the provided epoch.
Tombstone(ctx context.Context, a oid.Address, epoch uint64) (*object.Object, error) Tombstone(ctx context.Context, a oid.Address, epoch uint64) (*objectSDK.Object, error)
} }
// ExpirationChecker is a tombstone source wrapper. // ExpirationChecker is a tombstone source wrapper.
@ -72,7 +72,7 @@ func (g *ExpirationChecker) IsTombstoneAvailable(ctx context.Context, a oid.Addr
return false return false
} }
func (g *ExpirationChecker) handleTS(addr string, ts *object.Object, reqEpoch uint64) bool { func (g *ExpirationChecker) handleTS(addr string, ts *objectSDK.Object, reqEpoch uint64) bool {
for _, atr := range ts.Attributes() { for _, atr := range ts.Attributes() {
if atr.Key() == objectV2.SysAttributeExpEpoch || atr.Key() == objectV2.SysAttributeExpEpochNeoFS { if atr.Key() == objectV2.SysAttributeExpEpoch || atr.Key() == objectV2.SysAttributeExpEpochNeoFS {
epoch, err := strconv.ParseUint(atr.Value(), 10, 64) epoch, err := strconv.ParseUint(atr.Value(), 10, 64)

View file

@ -11,7 +11,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -97,7 +97,7 @@ func (p *Policer) processNodes(ctx context.Context, requirements *placementRequi
// Number of copies that are stored on maintenance nodes. // Number of copies that are stored on maintenance nodes.
var uncheckedCopies int var uncheckedCopies int
if typ == object.TypeLock { if typ == objectSDK.TypeLock {
// all nodes of a container must store the `LOCK` objects // all nodes of a container must store the `LOCK` objects
// for correct object removal protection: // for correct object removal protection:
// - `LOCK` objects are broadcast on their PUT requests; // - `LOCK` objects are broadcast on their PUT requests;

View file

@ -14,7 +14,7 @@ import (
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
"github.com/panjf2000/ants/v2" "github.com/panjf2000/ants/v2"
@ -27,7 +27,7 @@ func TestBuryObjectWithoutContainer(t *testing.T) {
objs := []objectcore.AddressWithType{ objs := []objectcore.AddressWithType{
{ {
Address: addr, Address: addr,
Type: object.TypeRegular, Type: objectSDK.TypeRegular,
}, },
} }
@ -68,7 +68,7 @@ func TestProcessObject(t *testing.T) {
// - policy is used only to match the number of replicas for each index in the placement // - policy is used only to match the number of replicas for each index in the placement
tests := []struct { tests := []struct {
desc string desc string
objType object.Type objType objectSDK.Type
nodeCount int nodeCount int
policy string policy string
placement [][]int placement [][]int
@ -128,7 +128,7 @@ func TestProcessObject(t *testing.T) {
}, },
{ {
desc: "lock object must be replicated to all nodes", desc: "lock object must be replicated to all nodes",
objType: object.TypeLock, objType: objectSDK.TypeLock,
nodeCount: 3, nodeCount: 3,
policy: `REP 1`, policy: `REP 1`,
placement: [][]int{{0, 1, 2}}, placement: [][]int{{0, 1, 2}},
@ -176,7 +176,7 @@ func TestProcessObject(t *testing.T) {
} }
// Object remote header // Object remote header
headFn := func(_ context.Context, ni netmap.NodeInfo, a oid.Address) (*object.Object, error) { headFn := func(_ context.Context, ni netmap.NodeInfo, a oid.Address) (*objectSDK.Object, error) {
index := int(ni.PublicKey()[0]) index := int(ni.PublicKey()[0])
if a != addr || index < 1 || index >= ti.nodeCount { if a != addr || index < 1 || index >= ti.nodeCount {
t.Errorf("unexpected remote object head: node=%+v addr=%v", ni, a) t.Errorf("unexpected remote object head: node=%+v addr=%v", ni, a)