diff --git a/cmd/frostfs-cli/internal/client/client.go b/cmd/frostfs-cli/internal/client/client.go index 9545c60c..babc0ef3 100644 --- a/cmd/frostfs-cli/internal/client/client.go +++ b/cmd/frostfs-cli/internal/client/client.go @@ -13,7 +13,7 @@ import ( 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/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" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" ) @@ -331,17 +331,17 @@ type PutObjectPrm struct { copyNum []uint32 - hdr *object.Object + hdr *objectSDK.Object rdr io.Reader - headerCallback func(*object.Object) + headerCallback func(*objectSDK.Object) prepareLocally bool } // SetHeader sets object header. -func (x *PutObjectPrm) SetHeader(hdr *object.Object) { +func (x *PutObjectPrm) SetHeader(hdr *objectSDK.Object) { 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 // 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 } @@ -532,22 +532,22 @@ type GetObjectPrm struct { objectAddressPrm rawPrm payloadWriterPrm - headerCallback func(*object.Object) + headerCallback func(*objectSDK.Object) } // SetHeaderCallback sets callback which is called on the object after the header is received // 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 } // GetObjectRes groups the resulting values of GetObject operation. type GetObjectRes struct { - hdr *object.Object + hdr *objectSDK.Object } // Header returns the header of the request object. -func (x GetObjectRes) Header() *object.Object { +func (x GetObjectRes) Header() *objectSDK.Object { 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) } - var hdr object.Object + var hdr objectSDK.Object if !rdr.ReadHeader(&hdr) { _, err = rdr.Close() @@ -621,11 +621,11 @@ func (x *HeadObjectPrm) SetMainOnlyFlag(v bool) { // HeadObjectRes groups the resulting values of HeadObject operation. type HeadObjectRes struct { - hdr *object.Object + hdr *objectSDK.Object } // Header returns the requested object header. -func (x HeadObjectRes) Header() *object.Object { +func (x HeadObjectRes) Header() *objectSDK.Object { 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) } - var hdr object.Object + var hdr objectSDK.Object if !res.ReadHeader(&hdr) { return nil, fmt.Errorf("missing header in response") @@ -677,11 +677,11 @@ type SearchObjectsPrm struct { commonObjectPrm containerIDPrm - filters object.SearchFilters + filters objectSDK.SearchFilters } // SetFilters sets search filters. -func (x *SearchObjectsPrm) SetFilters(filters object.SearchFilters) { +func (x *SearchObjectsPrm) SetFilters(filters objectSDK.SearchFilters) { x.filters = filters } @@ -754,7 +754,7 @@ type HashPayloadRangesPrm struct { tz bool - rngs []*object.Range + rngs []*objectSDK.Range salt []byte } @@ -765,7 +765,7 @@ func (x *HashPayloadRangesPrm) TZ() { } // 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 } @@ -839,11 +839,11 @@ type PayloadRangePrm struct { rawPrm payloadWriterPrm - rng *object.Range + rng *objectSDK.Range } // SetRange sets payload range to read. -func (x *PayloadRangePrm) SetRange(rng *object.Range) { +func (x *PayloadRangePrm) SetRange(rng *objectSDK.Range) { x.rng = rng } diff --git a/cmd/frostfs-cli/modules/container/list_objects.go b/cmd/frostfs-cli/modules/container/list_objects.go index d00cc357..1e0aeb4d 100644 --- a/cmd/frostfs-cli/modules/container/list_objects.go +++ b/cmd/frostfs-cli/modules/container/list_objects.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" objectCli "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/modules/object" 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" "github.com/spf13/cobra" ) @@ -31,7 +31,7 @@ var listContainerObjectsCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { id := parseContainerID(cmd) - filters := new(object.SearchFilters) + filters := new(objectSDK.SearchFilters) filters.AddRootFilter() // search only user created objects cli := internalclient.GetSDKClientByFlag(cmd, key.GetOrGenerate(cmd), commonflags.RPC) diff --git a/cmd/frostfs-cli/modules/object/get.go b/cmd/frostfs-cli/modules/object/get.go index c72a2623..3136f086 100644 --- a/cmd/frostfs-cli/modules/object/get.go +++ b/cmd/frostfs-cli/modules/object/get.go @@ -11,7 +11,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" 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" "github.com/cheggaaa/pb" "github.com/spf13/cobra" @@ -84,7 +84,7 @@ func getObject(cmd *cobra.Command, _ []string) { p = pb.New64(0) p.Output = cmd.OutOrStdout() prm.SetPayloadWriter(p.NewProxyWriter(payloadWriter)) - prm.SetHeaderCallback(func(o *object.Object) { + prm.SetHeaderCallback(func(o *objectSDK.Object) { p.SetTotal64(int64(o.PayloadSize())) p.Start() }) diff --git a/cmd/frostfs-cli/modules/object/head.go b/cmd/frostfs-cli/modules/object/head.go index 04467744..db466e58 100644 --- a/cmd/frostfs-cli/modules/object/head.go +++ b/cmd/frostfs-cli/modules/object/head.go @@ -13,7 +13,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" 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" "github.com/spf13/cobra" ) @@ -77,7 +77,7 @@ func getObjectHeader(cmd *cobra.Command, _ []string) { 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) if err != nil { 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) } -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) toProto, _ := cmd.Flags().GetBool("proto") switch { @@ -138,7 +138,7 @@ func printContainerID(cmd *cobra.Command, recv func() (cid.ID, bool)) { 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) printContainerID(cmd, obj.ContainerID) cmd.Printf("Owner: %s\n", obj.OwnerID()) @@ -150,7 +150,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error { cmd.Println("Attributes:") for _, attr := range obj.Attributes() { - if attr.Key() == object.AttributeTimestamp { + if attr.Key() == objectSDK.AttributeTimestamp { cmd.Printf(" %s=%s (%s)\n", attr.Key(), attr.Value(), @@ -174,7 +174,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error { 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 { cmd.Printf("Split ID: %s\n", splitID) } diff --git a/cmd/frostfs-cli/modules/object/put.go b/cmd/frostfs-cli/modules/object/put.go index c5b4e6e0..97bb12db 100644 --- a/cmd/frostfs-cli/modules/object/put.go +++ b/cmd/frostfs-cli/modules/object/put.go @@ -16,7 +16,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" 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" "github.com/cheggaaa/pb" "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)) } var payloadReader io.Reader = f - obj := object.New() + obj := objectSDK.New() if binary { 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) { buf, err := os.ReadFile(filename) 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 commonCmd.ExitOnErr(cmd, "can't unmarshal object from given file: %w", objTemp.Unmarshal(buf)) 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.Output = cmd.OutOrStdout() prm.SetPayloadReader(p.NewProxyReader(f)) - prm.SetHeaderCallback(func(o *object.Object) { p.Start() }) + prm.SetHeaderCallback(func(o *objectSDK.Object) { p.Start() }) 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.Output = cmd.OutOrStdout() prm.SetPayloadReader(p.NewProxyReader(payloadReader)) - prm.SetHeaderCallback(func(o *object.Object) { p.Start() }) + prm.SetHeaderCallback(func(o *objectSDK.Object) { p.Start() }) return p } -func getAllObjectAttributes(cmd *cobra.Command) []object.Attribute { +func getAllObjectAttributes(cmd *cobra.Command) []objectSDK.Attribute { attrs, err := parseObjectAttrs(cmd) commonCmd.ExitOnErr(cmd, "can't parse object attributes: %w", err) @@ -205,7 +205,7 @@ func getAllObjectAttributes(cmd *cobra.Command) []object.Attribute { if !expAttrFound { index := len(attrs) - attrs = append(attrs, object.Attribute{}) + attrs = append(attrs, objectSDK.Attribute{}) attrs[index].SetKey(objectV2.SysAttributeExpEpoch) attrs[index].SetValue(expAttrValue) } @@ -213,7 +213,7 @@ func getAllObjectAttributes(cmd *cobra.Command) []object.Attribute { return attrs } -func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) { +func parseObjectAttrs(cmd *cobra.Command) ([]objectSDK.Attribute, error) { var rawAttrs []string raw := cmd.Flag("attributes").Value.String() @@ -221,7 +221,7 @@ func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) { 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 { k, v, found := strings.Cut(rawAttrs[i], "=") if !found { @@ -235,23 +235,23 @@ func parseObjectAttrs(cmd *cobra.Command) ([]object.Attribute, error) { if !disableFilename { filename := filepath.Base(cmd.Flag(fileFlag).Value.String()) index := len(attrs) - attrs = append(attrs, object.Attribute{}) - attrs[index].SetKey(object.AttributeFileName) + attrs = append(attrs, objectSDK.Attribute{}) + attrs[index].SetKey(objectSDK.AttributeFileName) attrs[index].SetValue(filename) } disableTime, _ := cmd.Flags().GetBool("disable-timestamp") if !disableTime { index := len(attrs) - attrs = append(attrs, object.Attribute{}) - attrs[index].SetKey(object.AttributeTimestamp) + attrs = append(attrs, objectSDK.Attribute{}) + attrs[index].SetKey(objectSDK.AttributeTimestamp) attrs[index].SetValue(strconv.FormatInt(time.Now().Unix(), 10)) } return attrs, nil } -func parseObjectNotifications(cmd *cobra.Command) (*object.NotificationInfo, error) { +func parseObjectNotifications(cmd *cobra.Command) (*objectSDK.NotificationInfo, error) { const ( separator = ":" 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) } - ni := new(object.NotificationInfo) + ni := new(objectSDK.NotificationInfo) epoch, err := strconv.ParseUint(before, 10, 64) if err != nil { diff --git a/cmd/frostfs-cli/modules/object/range.go b/cmd/frostfs-cli/modules/object/range.go index 76425d94..591355b9 100644 --- a/cmd/frostfs-cli/modules/object/range.go +++ b/cmd/frostfs-cli/modules/object/range.go @@ -14,7 +14,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" 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" "github.com/spf13/cobra" ) @@ -102,7 +102,7 @@ func getObjectRange(cmd *cobra.Command, _ []string) { } func printSplitInfoErr(cmd *cobra.Command, err error) bool { - var errSplitInfo *object.SplitInfoError + var errSplitInfo *objectSDK.SplitInfoError ok := errors.As(err, &errSplitInfo) @@ -114,14 +114,14 @@ func printSplitInfoErr(cmd *cobra.Command, err error) bool { return ok } -func printSplitInfo(cmd *cobra.Command, info *object.SplitInfo) { +func printSplitInfo(cmd *cobra.Command, info *objectSDK.SplitInfo) { bs, err := marshalSplitInfo(cmd, info) commonCmd.ExitOnErr(cmd, "can't marshal split info: %w", err) 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) toProto, _ := cmd.Flags().GetBool("proto") 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() if len(v) == 0 { return nil, nil } vs := strings.Split(v, ",") - rs := make([]*object.Range, len(vs)) + rs := make([]*objectSDK.Range, len(vs)) for i := range vs { before, after, found := strings.Cut(vs[i], rangeSep) 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]) } - rs[i] = object.NewRange() + rs[i] = objectSDK.NewRange() rs[i].SetOffset(offset) rs[i].SetLength(length) } diff --git a/cmd/frostfs-cli/modules/object/search.go b/cmd/frostfs-cli/modules/object/search.go index b603e5fe..ca5d78bc 100644 --- a/cmd/frostfs-cli/modules/object/search.go +++ b/cmd/frostfs-cli/modules/object/search.go @@ -10,7 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" 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" "github.com/spf13/cobra" ) @@ -72,18 +72,18 @@ func searchObject(cmd *cobra.Command, _ []string) { } } -var searchUnaryOpVocabulary = map[string]object.SearchMatchType{ - "NOPRESENT": object.MatchNotPresent, +var searchUnaryOpVocabulary = map[string]objectSDK.SearchMatchType{ + "NOPRESENT": objectSDK.MatchNotPresent, } -var searchBinaryOpVocabulary = map[string]object.SearchMatchType{ - "EQ": object.MatchStringEqual, - "NE": object.MatchStringNotEqual, - "COMMON_PREFIX": object.MatchCommonPrefix, +var searchBinaryOpVocabulary = map[string]objectSDK.SearchMatchType{ + "EQ": objectSDK.MatchStringEqual, + "NE": objectSDK.MatchStringNotEqual, + "COMMON_PREFIX": objectSDK.MatchCommonPrefix, } -func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) { - var fs object.SearchFilters +func parseSearchFilters(cmd *cobra.Command) (objectSDK.SearchFilters, error) { + var fs objectSDK.SearchFilters for i := range searchFilters { 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) } - subFs := object.NewSearchFilters() + subFs := objectSDK.NewSearchFilters() if err := subFs.UnmarshalJSON(data); err != nil { 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) } - fs.AddObjectIDFilter(object.MatchStringEqual, id) + fs.AddObjectIDFilter(objectSDK.MatchStringEqual, id) } return fs, nil diff --git a/cmd/frostfs-cli/modules/object/util.go b/cmd/frostfs-cli/modules/object/util.go index 094b6231..37e9f74e 100644 --- a/cmd/frostfs-cli/modules/object/util.go +++ b/cmd/frostfs-cli/modules/object/util.go @@ -16,7 +16,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" 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" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" "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 { buf, err := os.ReadFile(filename) 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)) 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) - var errSplit *object.SplitInfoError + var errSplit *objectSDK.SplitInfoError switch { default: @@ -381,7 +381,7 @@ func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID, 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). // 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 } -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 { common.PrintVerbose(cmd, "Collecting split members by split ID...") - var query object.SearchFilters - query.AddSplitIDFilter(object.MatchStringEqual, idSplit) + var query objectSDK.SearchFilters + query.AddSplitIDFilter(objectSDK.MatchStringEqual, idSplit) var prm internal.SearchObjectsPrm prm.SetContainerID(cnr) @@ -437,7 +437,7 @@ func tryGetSplitMembersBySplitID(cmd *cobra.Command, splitInfo *object.SplitInfo 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 addrObj.SetContainer(cnr) @@ -482,8 +482,8 @@ func tryRestoreChainInReverse(cmd *cobra.Command, splitInfo *object.SplitInfo, p common.PrintVerbose(cmd, "Looking for a linking object...") - var query object.SearchFilters - query.AddParentIDFilter(object.MatchStringEqual, obj) + var query objectSDK.SearchFilters + query.AddParentIDFilter(objectSDK.MatchStringEqual, obj) var prmSearch internal.SearchObjectsPrm prmSearch.SetClient(cli) diff --git a/cmd/frostfs-cli/modules/tree/add_by_path.go b/cmd/frostfs-cli/modules/tree/add_by_path.go index 6b182e1e..90f4a636 100644 --- a/cmd/frostfs-cli/modules/tree/add_by_path.go +++ b/cmd/frostfs-cli/modules/tree/add_by_path.go @@ -10,7 +10,7 @@ import ( commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree" 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" ) @@ -68,7 +68,7 @@ func addByPath(cmd *cobra.Command, _ []string) { req.Body = &tree.AddByPathRequest_Body{ ContainerId: rawCID, TreeId: tid, - PathAttribute: object.AttributeFileName, + PathAttribute: objectSDK.AttributeFileName, // PathAttribute: pAttr, Path: strings.Split(path, "/"), Meta: meta, diff --git a/cmd/frostfs-cli/modules/tree/get_by_path.go b/cmd/frostfs-cli/modules/tree/get_by_path.go index 69a3dc7e..38ad2bff 100644 --- a/cmd/frostfs-cli/modules/tree/get_by_path.go +++ b/cmd/frostfs-cli/modules/tree/get_by_path.go @@ -10,7 +10,7 @@ import ( commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree" 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" ) @@ -66,7 +66,7 @@ func getByPath(cmd *cobra.Command, _ []string) { req.Body = &tree.GetNodeByPathRequest_Body{ ContainerId: rawCID, TreeId: tid, - PathAttribute: object.AttributeFileName, + PathAttribute: objectSDK.AttributeFileName, // PathAttribute: pAttr, Path: strings.Split(path, "/"), LatestOnly: latestOnly, diff --git a/cmd/frostfs-lens/internal/blobovnicza/inspect.go b/cmd/frostfs-lens/internal/blobovnicza/inspect.go index 13442a4b..b1a6e3fd 100644 --- a/cmd/frostfs-lens/internal/blobovnicza/inspect.go +++ b/cmd/frostfs-lens/internal/blobovnicza/inspect.go @@ -3,7 +3,7 @@ package blobovnicza import ( 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-sdk-go/object" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "github.com/spf13/cobra" ) @@ -38,7 +38,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) { data := res.Object() - var o object.Object + var o objectSDK.Object common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w", o.Unmarshal(data)), ) diff --git a/cmd/frostfs-lens/internal/meta/inspect.go b/cmd/frostfs-lens/internal/meta/inspect.go index bc7f28a3..de0f24ae 100644 --- a/cmd/frostfs-lens/internal/meta/inspect.go +++ b/cmd/frostfs-lens/internal/meta/inspect.go @@ -7,7 +7,7 @@ import ( common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobovnicza" 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" "github.com/spf13/cobra" ) @@ -49,7 +49,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) { prm.SetAddress(addr) prm.SetRaw(true) - siErr := new(object.SplitInfoError) + siErr := new(objectSDK.SplitInfoError) res, err := db.Get(cmd.Context(), prm) if errors.As(err, &siErr) { diff --git a/cmd/frostfs-lens/internal/printers.go b/cmd/frostfs-lens/internal/printers.go index a232409d..dd73a555 100644 --- a/cmd/frostfs-lens/internal/printers.go +++ b/cmd/frostfs-lens/internal/printers.go @@ -4,14 +4,14 @@ import ( "os" 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" "github.com/spf13/cobra" ) // PrintObjectHeader prints passed object's header fields via // 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("Type:", h.Type()) printContainerID(cmd, h.ContainerID) diff --git a/cmd/frostfs-lens/internal/writecache/inspect.go b/cmd/frostfs-lens/internal/writecache/inspect.go index 91f12ed0..7d3c8ab2 100644 --- a/cmd/frostfs-lens/internal/writecache/inspect.go +++ b/cmd/frostfs-lens/internal/writecache/inspect.go @@ -3,7 +3,7 @@ package writecache import ( 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-sdk-go/object" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "github.com/spf13/cobra" ) @@ -27,7 +27,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) { data, err := writecache.Get(db, []byte(vAddress)) 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.PrintObjectHeader(cmd, o) diff --git a/pkg/core/object/address.go b/pkg/core/object/address.go index cd5559d9..12e5c89c 100644 --- a/pkg/core/object/address.go +++ b/pkg/core/object/address.go @@ -1,7 +1,7 @@ package object 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" ) @@ -9,5 +9,5 @@ import ( // object type. type AddressWithType struct { Address oid.Address - Type object.Type + Type objectSDK.Type } diff --git a/pkg/core/object/fmt.go b/pkg/core/object/fmt.go index ba986869..abf8f02c 100644 --- a/pkg/core/object/fmt.go +++ b/pkg/core/object/fmt.go @@ -12,7 +12,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" 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" "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. // // 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 { 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) } - 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) } } @@ -132,7 +132,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unpr return nil } -func (v *FormatValidator) validateSignatureKey(obj *object.Object) error { +func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error { sig := obj.Signature() if sig == nil { // TODO(@cthulhu-rider): #468 use "const" error @@ -178,13 +178,13 @@ func (v *FormatValidator) checkOwnerKey(id user.ID, key frostfsecdsa.PublicKey) // - object.TypeTombstone; // - object.TypeLock. type ContentMeta struct { - typ object.Type + typ objectSDK.Type objs []oid.ID } // Type returns object's type. -func (i ContentMeta) Type() object.Type { +func (i ContentMeta) Type() objectSDK.Type { return i.typ } @@ -197,17 +197,17 @@ func (i ContentMeta) Objects() []oid.ID { } // 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{ typ: o.Type(), } switch o.Type() { - case object.TypeTombstone: + case objectSDK.TypeTombstone: if err := v.fillAndValidateTombstoneMeta(o, &meta); err != nil { return ContentMeta{}, err } - case object.TypeLock: + case objectSDK.TypeLock: if err := v.fillAndValidateLockMeta(o, &meta); err != nil { return ContentMeta{}, err } @@ -218,7 +218,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error) 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 { 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) } - var lock object.Lock + var lock objectSDK.Lock if err = lock.Unmarshal(o.Payload()); err != nil { return fmt.Errorf("decode lock payload: %w", err) @@ -256,12 +256,12 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *Conten 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 { return fmt.Errorf("(%T) empty payload in tombstone", v) } - tombstone := object.NewTombstone() + tombstone := objectSDK.NewTombstone() if err := tombstone.Unmarshal(o.Payload()); err != nil { 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") -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) if err != nil { if errors.Is(err, errNoExpirationEpoch) { @@ -321,7 +321,7 @@ func (v *FormatValidator) checkExpiration(ctx context.Context, obj *object.Objec return nil } -func expirationEpochAttribute(obj *object.Object) (uint64, error) { +func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) { for _, a := range obj.Attributes() { if a.Key() != objectV2.SysAttributeExpEpoch && a.Key() != objectV2.SysAttributeExpEpochNeoFS { continue @@ -338,7 +338,7 @@ var ( 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() 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") -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 { return errIncorrectOwner } diff --git a/pkg/core/object/fmt_test.go b/pkg/core/object/fmt_test.go index 2cf5099b..d04c1670 100644 --- a/pkg/core/object/fmt_test.go +++ b/pkg/core/object/fmt_test.go @@ -8,7 +8,7 @@ import ( objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session/test" @@ -17,11 +17,11 @@ import ( "github.com/stretchr/testify/require" ) -func blankValidObject(key *ecdsa.PrivateKey) *object.Object { +func blankValidObject(key *ecdsa.PrivateKey) *objectSDK.Object { var idOwner user.ID user.IDFromKey(&idOwner, key.PublicKey) - obj := object.New() + obj := objectSDK.New() obj.SetContainerID(cidtest.ID()) obj.SetOwnerID(&idOwner) @@ -66,20 +66,20 @@ func TestFormatValidator_Validate(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) }) t.Run("nil container identifier", func(t *testing.T) { - obj := object.New() + obj := objectSDK.New() obj.SetID(oidtest.ID()) require.ErrorIs(t, v.Validate(context.Background(), obj, true), errNilCID) }) t.Run("unsigned object", func(t *testing.T) { - obj := object.New() + obj := objectSDK.New() obj.SetContainerID(cidtest.ID()) obj.SetID(oidtest.ID()) @@ -94,12 +94,12 @@ func TestFormatValidator_Validate(t *testing.T) { err := tok.Sign(ownerKey.PrivateKey) require.NoError(t, err) - obj := object.New() + obj := objectSDK.New() obj.SetContainerID(cidtest.ID()) obj.SetSessionToken(tok) 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)) }) @@ -107,20 +107,20 @@ func TestFormatValidator_Validate(t *testing.T) { t.Run("correct w/o session token", func(t *testing.T) { 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)) }) t.Run("tombstone content", func(t *testing.T) { - obj := object.New() - obj.SetType(object.TypeTombstone) + obj := objectSDK.New() + obj.SetType(objectSDK.TypeTombstone) obj.SetContainerID(cidtest.ID()) _, err := v.ValidateContent(obj) require.Error(t, err) // no tombstone content - content := object.NewTombstone() + content := objectSDK.NewTombstone() content.SetMembers([]oid.ID{oidtest.ID()}) data, err := content.Marshal() @@ -141,7 +141,7 @@ func TestFormatValidator_Validate(t *testing.T) { _, err = v.ValidateContent(obj) require.Error(t, err) // no expiration epoch in tombstone - var expirationAttribute object.Attribute + var expirationAttribute objectSDK.Attribute expirationAttribute.SetKey(objectV2.SysAttributeExpEpoch) expirationAttribute.SetValue(strconv.Itoa(10)) @@ -163,20 +163,20 @@ func TestFormatValidator_Validate(t *testing.T) { require.NoError(t, err) // all good 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) { - fn := func(val string) *object.Object { + fn := func(val string) *objectSDK.Object { obj := blankValidObject(&ownerKey.PrivateKey) - var a object.Attribute + var a objectSDK.Attribute a.SetKey(objectV2.SysAttributeExpEpoch) a.SetValue(val) obj.SetAttributes(a) - require.NoError(t, object.SetIDWithSignature(ownerKey.PrivateKey, obj)) + require.NoError(t, objectSDK.SetIDWithSignature(ownerKey.PrivateKey, obj)) return obj } @@ -221,11 +221,11 @@ func TestFormatValidator_Validate(t *testing.T) { t.Run("duplication", func(t *testing.T) { obj := blankValidObject(&ownerKey.PrivateKey) - var a1 object.Attribute + var a1 objectSDK.Attribute a1.SetKey("key1") a1.SetValue("val1") - var a2 object.Attribute + var a2 objectSDK.Attribute a2.SetKey("key2") a2.SetValue("val2") @@ -244,7 +244,7 @@ func TestFormatValidator_Validate(t *testing.T) { t.Run("empty value", func(t *testing.T) { obj := blankValidObject(&ownerKey.PrivateKey) - var a object.Attribute + var a objectSDK.Attribute a.SetKey("key") obj.SetAttributes(a) diff --git a/pkg/core/object/object.go b/pkg/core/object/object.go index 8fb656ac..9c450966 100644 --- a/pkg/core/object/object.go +++ b/pkg/core/object/object.go @@ -1,12 +1,12 @@ package object 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" ) // 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 id, ok := obj.ID() diff --git a/pkg/local_object_storage/engine/engine_test.go b/pkg/local_object_storage/engine/engine_test.go index 11c0848f..26de2e5e 100644 --- a/pkg/local_object_storage/engine/engine_test.go +++ b/pkg/local_object_storage/engine/engine_test.go @@ -18,7 +18,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" 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" "git.frostfs.info/TrueCloudLab/hrw" "github.com/panjf2000/ants/v2" @@ -148,7 +148,7 @@ func newStorages(root string, smallSize uint64) []blobstor.SubStorage { blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowWidth(1), blobovniczatree.WithPermissions(0700)), - Policy: func(_ *object.Object, data []byte) bool { + Policy: func(_ *objectSDK.Object, data []byte) bool { return uint64(len(data)) < smallSize }, }, @@ -176,7 +176,7 @@ func newTestStorages(root string, smallSize uint64) ([]blobstor.SubStorage, *tes return []blobstor.SubStorage{ { Storage: smallFileStorage, - Policy: func(_ *object.Object, data []byte) bool { + Policy: func(_ *objectSDK.Object, data []byte) bool { return uint64(len(data)) < smallSize }, }, diff --git a/pkg/local_object_storage/engine/head_test.go b/pkg/local_object_storage/engine/head_test.go index bf00c428..d5bf8429 100644 --- a/pkg/local_object_storage/engine/head_test.go +++ b/pkg/local_object_storage/engine/head_test.go @@ -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/shard" 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" "github.com/stretchr/testify/require" ) @@ -17,7 +17,7 @@ func TestHeadRaw(t *testing.T) { defer os.RemoveAll(t.Name()) cnr := cidtest.ID() - splitID := object.NewSplitID() + splitID := objectSDK.NewSplitID() parent := testutil.GenerateObjectWithCID(cnr) testutil.AddAttribute(parent, "foo", "bar") @@ -70,7 +70,7 @@ func TestHeadRaw(t *testing.T) { _, err = e.Head(context.Background(), headPrm) require.Error(t, err) - var si *object.SplitInfoError + var si *objectSDK.SplitInfoError require.ErrorAs(t, err, &si) // SplitInfoError should contain info from both shards diff --git a/pkg/local_object_storage/engine/lock_test.go b/pkg/local_object_storage/engine/lock_test.go index 7796913e..a7f0a155 100644 --- a/pkg/local_object_storage/engine/lock_test.go +++ b/pkg/local_object_storage/engine/lock_test.go @@ -15,7 +15,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/panjf2000/ants/v2" @@ -83,7 +83,7 @@ func TestLockUserScenario(t *testing.T) { lockerAddr.SetContainer(cnr) lockerAddr.SetObject(lockerID) - var a object.Attribute + var a objectSDK.Attribute a.SetKey(objectV2.SysAttributeExpEpoch) a.SetValue(strconv.Itoa(lockerExpiresAfter)) @@ -105,9 +105,9 @@ func TestLockUserScenario(t *testing.T) { require.NoError(t, err) // 2. - var locker object.Lock + var locker objectSDK.Lock locker.WriteMembers([]oid.ID{id}) - object.WriteLock(lockerObj, locker) + objectSDK.WriteLock(lockerObj, locker) err = Put(context.Background(), e, lockerObj) require.NoError(t, err) @@ -123,7 +123,7 @@ func TestLockUserScenario(t *testing.T) { require.ErrorAs(t, err, new(apistatus.ObjectLocked)) // 4. - tombObj.SetType(object.TypeTombstone) + tombObj.SetType(objectSDK.TypeTombstone) tombObj.SetID(tombForLockID) tombObj.SetAttributes(a) @@ -188,12 +188,12 @@ func TestLockExpiration(t *testing.T) { require.NoError(t, err) // 2. - var a object.Attribute + var a objectSDK.Attribute a.SetKey(objectV2.SysAttributeExpEpoch) a.SetValue(strconv.Itoa(lockerExpiresAfter)) lock := testutil.GenerateObjectWithCID(cnr) - lock.SetType(object.TypeLock) + lock.SetType(objectSDK.TypeLock) lock.SetAttributes(a) err = Put(context.Background(), e, lock) @@ -266,7 +266,7 @@ func TestLockForceRemoval(t *testing.T) { // 2. lock := testutil.GenerateObjectWithCID(cnr) - lock.SetType(object.TypeLock) + lock.SetType(objectSDK.TypeLock) err = Put(context.Background(), e, lock) require.NoError(t, err) diff --git a/pkg/local_object_storage/engine/select.go b/pkg/local_object_storage/engine/select.go index 6a7bf1b7..6a8c9fab 100644 --- a/pkg/local_object_storage/engine/select.go +++ b/pkg/local_object_storage/engine/select.go @@ -6,7 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" @@ -15,7 +15,7 @@ import ( // SelectPrm groups the parameters of Select operation. type SelectPrm struct { cnr cid.ID - filters object.SearchFilters + filters objectSDK.SearchFilters } // 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. -func (p *SelectPrm) WithFilters(fs object.SearchFilters) { +func (p *SelectPrm) WithFilters(fs objectSDK.SearchFilters) { 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. -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 selectPrm.WithContainerID(cnr) selectPrm.WithFilters(fs) diff --git a/pkg/local_object_storage/engine/tree_test.go b/pkg/local_object_storage/engine/tree_test.go index 4cd35a08..f1650b5a 100644 --- a/pkg/local_object_storage/engine/tree_test.go +++ b/pkg/local_object_storage/engine/tree_test.go @@ -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/pilorama" 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) { @@ -47,8 +47,8 @@ func benchmarkTreeVsSearch(b *testing.B, objCount int) { var prm SelectPrm prm.WithContainerID(cid) - var fs object.SearchFilters - fs.AddFilter(pilorama.AttributeFilename, strconv.Itoa(objCount/2), object.MatchStringEqual) + var fs objectSDK.SearchFilters + fs.AddFilter(pilorama.AttributeFilename, strconv.Itoa(objCount/2), objectSDK.MatchStringEqual) prm.WithFilters(fs) for i := 0; i < b.N; i++ { diff --git a/pkg/local_object_storage/internal/testutil/generators.go b/pkg/local_object_storage/internal/testutil/generators.go index 059f00b3..383c596a 100644 --- a/pkg/local_object_storage/internal/testutil/generators.go +++ b/pkg/local_object_storage/internal/testutil/generators.go @@ -6,7 +6,7 @@ import ( "testing" 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" "github.com/stretchr/testify/require" "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. 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. @@ -59,7 +59,7 @@ type SeqObjGenerator struct { 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) _, _ = rand.Read(data) obj := GenerateObjectWithCIDWithPayload(cid, data) @@ -67,7 +67,7 @@ func generateObjectWithOIDWithCIDWithSize(oid oid.ID, cid cid.ID, sz uint64) *ob return obj } -func (g *SeqObjGenerator) Next() *object.Object { +func (g *SeqObjGenerator) Next() *objectSDK.Object { var id oid.ID binary.LittleEndian.PutUint64(id[:], g.cnt.Add(1)) return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize) @@ -80,7 +80,7 @@ type RandObjGenerator struct { var _ ObjectGenerator = &RandObjGenerator{} -func (g *RandObjGenerator) Next() *object.Object { +func (g *RandObjGenerator) Next() *objectSDK.Object { var id oid.ID _, _ = rand.Read(id[:]) return generateObjectWithOIDWithCIDWithSize(id, cid.ID{}, g.ObjSize) @@ -92,13 +92,13 @@ type OverwriteObjGenerator struct { MaxObjects uint64 } -func (g *OverwriteObjGenerator) Next() *object.Object { +func (g *OverwriteObjGenerator) Next() *objectSDK.Object { var id oid.ID binary.LittleEndian.PutUint64(id[:], uint64(1+rand.Int63n(int64(g.MaxObjects)))) 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 id, isSet := obj.ID() diff --git a/pkg/local_object_storage/internal/testutil/object.go b/pkg/local_object_storage/internal/testutil/object.go index 4f6d9581..9cbce27b 100644 --- a/pkg/local_object_storage/internal/testutil/object.go +++ b/pkg/local_object_storage/internal/testutil/object.go @@ -6,7 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" 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" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" @@ -16,17 +16,17 @@ import ( const defaultDataSize = 32 -func GenerateObject() *object.Object { +func GenerateObject() *objectSDK.Object { return GenerateObjectWithCID(cidtest.ID()) } -func GenerateObjectWithCID(cnr cid.ID) *object.Object { +func GenerateObjectWithCID(cnr cid.ID) *objectSDK.Object { data := make([]byte, defaultDataSize) _, _ = rand.Read(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 ver.SetMajor(2) ver.SetMinor(1) @@ -37,7 +37,7 @@ func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *object.Object { var csumTZ checksum.Checksum csumTZ.SetTillichZemor(tz.Sum(csum.Value())) - obj := object.New() + obj := objectSDK.New() obj.SetID(oidtest.ID()) obj.SetOwnerID(usertest.ID()) obj.SetContainerID(cnr) @@ -49,8 +49,8 @@ func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *object.Object { return obj } -func AddAttribute(obj *object.Object, key, val string) { - var attr object.Attribute +func AddAttribute(obj *objectSDK.Object, key, val string) { + var attr objectSDK.Attribute attr.SetKey(key) attr.SetValue(val) @@ -59,7 +59,7 @@ func AddAttribute(obj *object.Object, key, val string) { obj.SetAttributes(attrs...) } -func AddPayload(obj *object.Object, size int) { +func AddPayload(obj *objectSDK.Object, size int) { buf := make([]byte, size) _, _ = rand.Read(buf) diff --git a/pkg/local_object_storage/metabase/counter_test.go b/pkg/local_object_storage/metabase/counter_test.go index 507bfcd8..2c5fa023 100644 --- a/pkg/local_object_storage/metabase/counter_test.go +++ b/pkg/local_object_storage/metabase/counter_test.go @@ -8,7 +8,7 @@ import ( objectcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/stretchr/testify/require" @@ -34,7 +34,7 @@ func TestCounters(t *testing.T) { t.Run("put", func(t *testing.T) { t.Parallel() db := newDB(t) - oo := make([]*object.Object, 0, objCount) + oo := make([]*objectSDK.Object, 0, objCount) for i := 0; i < objCount; i++ { oo = append(oo, testutil.GenerateObject()) } @@ -191,7 +191,7 @@ func TestCounters_Expired(t *testing.T) { oo := make([]oid.Address, objCount) 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 @@ -275,12 +275,12 @@ func TestCounters_Expired(t *testing.T) { 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 err error parent := testutil.GenerateObject() - oo := make([]*object.Object, 0, count) + oo := make([]*objectSDK.Object, 0, count) for i := 0; i < count; i++ { o := testutil.GenerateObject() if withParent { diff --git a/pkg/local_object_storage/metabase/db.go b/pkg/local_object_storage/metabase/db.go index e7de46e1..f5341ff2 100644 --- a/pkg/local_object_storage/metabase/db.go +++ b/pkg/local_object_storage/metabase/db.go @@ -14,7 +14,7 @@ import ( 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/util/logger" - "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "github.com/mr-tron/base58" "go.etcd.io/bbolt" "go.uber.org/zap" @@ -39,7 +39,7 @@ type DB struct { modeMtx sync.RWMutex mode mode.Mode - matchers map[object.SearchMatchType]matcher + matchers map[objectSDK.SearchMatchType]matcher boltDB *bbolt.DB @@ -89,20 +89,20 @@ func New(opts ...Option) *DB { return &DB{ cfg: c, - matchers: map[object.SearchMatchType]matcher{ - object.MatchUnknown: { + matchers: map[objectSDK.SearchMatchType]matcher{ + objectSDK.MatchUnknown: { matchSlow: unknownMatcher, matchBucket: unknownMatcherBucket, }, - object.MatchStringEqual: { + objectSDK.MatchStringEqual: { matchSlow: stringEqualMatcher, matchBucket: stringEqualMatcherBucket, }, - object.MatchStringNotEqual: { + objectSDK.MatchStringNotEqual: { matchSlow: stringNotEqualMatcher, matchBucket: stringNotEqualMatcherBucket, }, - object.MatchCommonPrefix: { + objectSDK.MatchCommonPrefix: { matchSlow: stringCommonPrefixMatcher, matchBucket: stringCommonPrefixMatcherBucket, }, @@ -276,7 +276,7 @@ func bucketKeyHelper(hdr string, val string) []byte { return v case v2object.FilterHeaderSplitID: - s := object.NewSplitID() + s := objectSDK.NewSplitID() err := s.Parse(val) if err != nil { diff --git a/pkg/local_object_storage/metabase/expired_test.go b/pkg/local_object_storage/metabase/expired_test.go index 5755b5cd..9a6bcc5d 100644 --- a/pkg/local_object_storage/metabase/expired_test.go +++ b/pkg/local_object_storage/metabase/expired_test.go @@ -6,7 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" 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" "github.com/stretchr/testify/require" ) @@ -77,7 +77,7 @@ func TestDB_SelectExpired(t *testing.T) { 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() if !set { t.Fatalf("container id required") diff --git a/pkg/local_object_storage/metabase/inhume.go b/pkg/local_object_storage/metabase/inhume.go index 76744aa3..7ba5a68a 100644 --- a/pkg/local_object_storage/metabase/inhume.go +++ b/pkg/local_object_storage/metabase/inhume.go @@ -12,7 +12,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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" "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) } -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() if inGraveyardWithKey(targetKey, graveyardBKT, garbageBKT) == 0 { 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 // with container size estimations - if obj.Type() == object.TypeRegular { + if obj.Type() == objectSDK.TypeRegular { err := changeContainerSize(tx, cnr, obj.PayloadSize(), false) if err != nil { return err diff --git a/pkg/local_object_storage/metabase/iterators.go b/pkg/local_object_storage/metabase/iterators.go index 78bfd291..a1e21ef2 100644 --- a/pkg/local_object_storage/metabase/iterators.go +++ b/pkg/local_object_storage/metabase/iterators.go @@ -12,7 +12,8 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.etcd.io/bbolt" "go.opentelemetry.io/otel/attribute" @@ -21,13 +22,13 @@ import ( // ExpiredObject is a descriptor of expired object from DB. type ExpiredObject struct { - typ object.Type + typ objectSDK.Type addr oid.Address } // Type returns type of the expired object. -func (e *ExpiredObject) Type() object.Type { +func (e *ExpiredObject) Type() objectSDK.Type { return e.typ } diff --git a/pkg/local_object_storage/metabase/iterators_test.go b/pkg/local_object_storage/metabase/iterators_test.go index e07184eb..034a931d 100644 --- a/pkg/local_object_storage/metabase/iterators_test.go +++ b/pkg/local_object_storage/metabase/iterators_test.go @@ -9,7 +9,7 @@ import ( object2 "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/stretchr/testify/require" @@ -20,19 +20,19 @@ func TestDB_IterateExpired(t *testing.T) { const epoch = 13 - mAlive := map[object.Type]oid.Address{} - mExpired := map[object.Type]oid.Address{} + mAlive := map[objectSDK.Type]oid.Address{} + mExpired := map[objectSDK.Type]oid.Address{} - for _, typ := range []object.Type{ - object.TypeRegular, - object.TypeTombstone, - object.TypeLock, + for _, typ := range []objectSDK.Type{ + objectSDK.TypeRegular, + objectSDK.TypeTombstone, + objectSDK.TypeLock, } { mAlive[typ] = putWithExpiration(t, db, typ, epoch) 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()})) @@ -56,7 +56,7 @@ func TestDB_IterateExpired(t *testing.T) { 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.SetType(typ) testutil.AddAttribute(obj, objectV2.SysAttributeExpEpoch, strconv.FormatUint(expiresAt, 10)) diff --git a/pkg/local_object_storage/metabase/list.go b/pkg/local_object_storage/metabase/list.go index 33726531..37a574a0 100644 --- a/pkg/local_object_storage/metabase/list.go +++ b/pkg/local_object_storage/metabase/list.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.etcd.io/bbolt" "go.opentelemetry.io/otel/attribute" @@ -124,15 +124,15 @@ loop: continue } - var objType object.Type + var objType objectSDK.Type switch prefix { case primaryPrefix: - objType = object.TypeRegular + objType = objectSDK.TypeRegular case lockersPrefix: - objType = object.TypeLock + objType = objectSDK.TypeLock case tombstonePrefix: - objType = object.TypeTombstone + objType = objectSDK.TypeTombstone default: continue } @@ -175,7 +175,7 @@ loop: // selectNFromBucket similar to selectAllFromBucket but uses cursor to find // object to start selecting from. Ignores inhumed objects. 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 cidRaw []byte, // container ID prefix, optimization cnt cid.ID, // container ID diff --git a/pkg/local_object_storage/metabase/lock.go b/pkg/local_object_storage/metabase/lock.go index f3388daf..50aac223 100644 --- a/pkg/local_object_storage/metabase/lock.go +++ b/pkg/local_object_storage/metabase/lock.go @@ -11,7 +11,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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" "go.etcd.io/bbolt" "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) 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{}) } diff --git a/pkg/local_object_storage/metabase/lock_test.go b/pkg/local_object_storage/metabase/lock_test.go index d5e06343..b442296f 100644 --- a/pkg/local_object_storage/metabase/lock_test.go +++ b/pkg/local_object_storage/metabase/lock_test.go @@ -9,7 +9,7 @@ import ( meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/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) { - for _, typ := range [...]object.Type{ - object.TypeTombstone, - object.TypeLock, - object.TypeRegular, + for _, typ := range [...]objectSDK.Type{ + objectSDK.TypeTombstone, + objectSDK.TypeLock, + objectSDK.TypeRegular, } { obj := objecttest.Object() obj.SetType(typ) @@ -47,7 +47,7 @@ func TestDB_Lock(t *testing.T) { // try to lock it err = db.Lock(context.Background(), cnr, oidtest.ID(), []oid.ID{id}) - if typ == object.TypeRegular { + if typ == objectSDK.TypeRegular { require.NoError(t, err, typ) } else { require.ErrorAs(t, err, &e, typ) @@ -180,7 +180,7 @@ func TestDB_Lock_Expired(t *testing.T) { db := newDB(t, meta.WithEpochState(es)) // put an object - addr := putWithExpiration(t, db, object.TypeRegular, 124) + addr := putWithExpiration(t, db, objectSDK.TypeRegular, 124) // expire the obj es.e = 125 @@ -242,10 +242,10 @@ func TestDB_IsLocked(t *testing.T) { } // 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() - lockedObjs := make([]*object.Object, 0, numOfLockedObjs) + lockedObjs := make([]*objectSDK.Object, 0, numOfLockedObjs) lockedObjIDs := make([]oid.ID, 0, numOfLockedObjs) 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) lockID, _ := lockObj.ID() - lockObj.SetType(object.TypeLock) + lockObj.SetType(objectSDK.TypeLock) err := putBig(db, lockObj) require.NoError(t, err) diff --git a/pkg/local_object_storage/metabase/select.go b/pkg/local_object_storage/metabase/select.go index 998ce9b9..6a7acd7c 100644 --- a/pkg/local_object_storage/metabase/select.go +++ b/pkg/local_object_storage/metabase/select.go @@ -13,7 +13,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.etcd.io/bbolt" "go.opentelemetry.io/otel/attribute" @@ -31,14 +31,14 @@ type ( cnr cid.ID - fastFilters, slowFilters object.SearchFilters + fastFilters, slowFilters objectSDK.SearchFilters } ) // SelectPrm groups the parameters of Select operation. type SelectPrm struct { cnr cid.ID - filters object.SearchFilters + filters objectSDK.SearchFilters } // 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. -func (p *SelectPrm) SetFilters(fs object.SearchFilters) { +func (p *SelectPrm) SetFilters(fs objectSDK.SearchFilters) { 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) if err != nil { return nil, err @@ -186,7 +186,7 @@ func selectAllFromBucket(tx *bbolt.Tx, name []byte, to map[string]int, fNum int) func (db *DB) selectFastFilter( tx *bbolt.Tx, cnr cid.ID, // container we search on - f object.SearchFilter, // fast filter + f objectSDK.SearchFilter, // fast filter to map[string]int, // resulting cache fNum int, // index of filter ) { @@ -220,7 +220,7 @@ func (db *DB) selectFastFilter( default: // user attribute bucketName := attributeBucketName(cnr, f.Header(), bucketName) - if f.Operation() == object.MatchNotPresent { + if f.Operation() == objectSDK.MatchNotPresent { selectOutsideFKBT(tx, allBucketNames(cnr), bucketName, to, fNum) } else { db.selectFromFKBT(tx, bucketName, f, to, fNum) @@ -244,7 +244,7 @@ func allBucketNames(cnr cid.ID) (names [][]byte) { 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) { fns, ok := mBucketNaming[key] if ok { @@ -256,15 +256,15 @@ func bucketNamesForType(cnr cid.ID, mType object.SearchMatchType, typeVal string switch mType { default: - case object.MatchStringNotEqual: + case objectSDK.MatchStringNotEqual: for key := range mBucketNaming { if key != typeVal { appendNames(key) } } - case object.MatchStringEqual: + case objectSDK.MatchStringEqual: appendNames(typeVal) - case object.MatchCommonPrefix: + case objectSDK.MatchCommonPrefix: for key := range mBucketNaming { if strings.HasPrefix(key, typeVal) { appendNames(key) @@ -280,7 +280,7 @@ func bucketNamesForType(cnr cid.ID, mType object.SearchMatchType, typeVal string func (db *DB) selectFromFKBT( tx *bbolt.Tx, 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 fNum int, // index of filter ) { // @@ -357,7 +357,7 @@ func selectOutsideFKBT( func (db *DB) selectFromList( tx *bbolt.Tx, 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 fNum int, // index of filter ) { // @@ -372,7 +372,7 @@ func (db *DB) selectFromList( ) switch op := f.Operation(); op { - case object.MatchStringEqual: + case objectSDK.MatchStringEqual: lst, err = decodeList(bkt.Get(bucketKeyHelper(f.Header(), f.Value()))) if err != nil { 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. func (db *DB) selectObjectID( tx *bbolt.Tx, - f object.SearchFilter, + f objectSDK.SearchFilter, cnr cid.ID, to map[string]int, // resulting cache fNum int, // index of filter @@ -436,7 +436,7 @@ func (db *DB) selectObjectID( } switch op := f.Operation(); op { - case object.MatchStringEqual: + case objectSDK.MatchStringEqual: var id oid.ID if err := id.DecodeString(f.Value()); err == nil { appendOID(id) @@ -451,7 +451,7 @@ func (db *DB) selectObjectID( return } - for _, bucketName := range bucketNamesForType(cnr, object.MatchStringNotEqual, "") { + for _, bucketName := range bucketNamesForType(cnr, objectSDK.MatchStringNotEqual, "") { // copy-paste from DB.selectAllFrom bkt := tx.Bucket(bucketName) if bkt == nil { @@ -475,7 +475,7 @@ func (db *DB) selectObjectID( } // 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 { 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 // processed by indexes and slow filters processed after by unmarshaling // object headers. -func groupFilters(filters object.SearchFilters) (filterGroup, error) { +func groupFilters(filters objectSDK.SearchFilters) (filterGroup, error) { res := filterGroup{ - fastFilters: make(object.SearchFilters, 0, len(filters)), - slowFilters: make(object.SearchFilters, 0, len(filters)), + fastFilters: make(objectSDK.SearchFilters, 0, len(filters)), + slowFilters: make(objectSDK.SearchFilters, 0, len(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. -func checkNonEmpty(fs object.SearchFilters) bool { +func checkNonEmpty(fs objectSDK.SearchFilters) bool { 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 } } diff --git a/pkg/local_object_storage/metabase/util.go b/pkg/local_object_storage/metabase/util.go index c50fd051..4e58ec20 100644 --- a/pkg/local_object_storage/metabase/util.go +++ b/pkg/local_object_storage/metabase/util.go @@ -6,7 +6,7 @@ import ( "fmt" 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" "go.etcd.io/bbolt" ) @@ -120,7 +120,7 @@ const ( 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 { 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. // // 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 { 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 irregularTypeBuckets := [...]struct { - typ object.Type + typ objectSDK.Type name []byte }{ - {object.TypeTombstone, tombstoneBucketName(idCnr, keys[0][:])}, - {object.TypeLock, bucketNameLockers(idCnr, keys[1][:])}, + {objectSDK.TypeTombstone, tombstoneBucketName(idCnr, keys[0][:])}, + {objectSDK.TypeLock, bucketNameLockers(idCnr, keys[1][:])}, } 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. diff --git a/pkg/local_object_storage/shard/gc.go b/pkg/local_object_storage/shard/gc.go index b8d51687..2221d57c 100644 --- a/pkg/local_object_storage/shard/gc.go +++ b/pkg/local_object_storage/shard/gc.go @@ -10,7 +10,7 @@ import ( "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/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" "go.uber.org/zap" "golang.org/x/sync/errgroup" @@ -335,7 +335,7 @@ func (s *Shard) collectExpiredObjects(ctx context.Context, e Event) { errGroup.Go(func() error { batch := make([]oid.Address, 0, batchSize) 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()) if len(batch) == batchSize { @@ -519,7 +519,7 @@ func (s *Shard) collectExpiredLocks(ctx context.Context, e Event) { batch := make([]oid.Address, 0, batchSize) 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()) if len(batch) == batchSize { diff --git a/pkg/local_object_storage/shard/gc_internal_test.go b/pkg/local_object_storage/shard/gc_internal_test.go index d9402997..bc895d67 100644 --- a/pkg/local_object_storage/shard/gc_internal_test.go +++ b/pkg/local_object_storage/shard/gc_internal_test.go @@ -17,7 +17,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" 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" "github.com/panjf2000/ants/v2" "github.com/stretchr/testify/require" @@ -41,7 +41,7 @@ func Test_ObjectNotFoundIfNotDeletedFromMetabase(t *testing.T) { blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")), blobovniczatree.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowWidth(1)), - Policy: func(_ *object.Object, data []byte) bool { + Policy: func(_ *objectSDK.Object, data []byte) bool { return len(data) <= 1<<20 }, }, diff --git a/pkg/local_object_storage/shard/list.go b/pkg/local_object_storage/shard/list.go index dd21745c..bc13c622 100644 --- a/pkg/local_object_storage/shard/list.go +++ b/pkg/local_object_storage/shard/list.go @@ -9,7 +9,7 @@ import ( meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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/trace" "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) } - filters := object.NewSearchFilters() + filters := objectSDK.NewSearchFilters() filters.AddPhyFilter() for i := range lst { diff --git a/pkg/local_object_storage/shard/lock_test.go b/pkg/local_object_storage/shard/lock_test.go index 75010179..61f2bb9f 100644 --- a/pkg/local_object_storage/shard/lock_test.go +++ b/pkg/local_object_storage/shard/lock_test.go @@ -15,7 +15,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/stretchr/testify/require" @@ -38,7 +38,7 @@ func TestShard_Lock(t *testing.T) { blobovniczatree.WithRootPath(filepath.Join(rootPath, "blob", "blobovnicza")), blobovniczatree.WithBlobovniczaShallowDepth(2), blobovniczatree.WithBlobovniczaShallowWidth(2)), - Policy: func(_ *object.Object, data []byte) bool { + Policy: func(_ *objectSDK.Object, data []byte) bool { return len(data) <= 1<<20 }, }, @@ -70,7 +70,7 @@ func TestShard_Lock(t *testing.T) { objID, _ := obj.ID() lock := testutil.GenerateObjectWithCID(cnr) - lock.SetType(object.TypeLock) + lock.SetType(objectSDK.TypeLock) lockID, _ := lock.ID() // put the object diff --git a/pkg/local_object_storage/shard/metrics_test.go b/pkg/local_object_storage/shard/metrics_test.go index d76c240b..ad0fc15c 100644 --- a/pkg/local_object_storage/shard/metrics_test.go +++ b/pkg/local_object_storage/shard/metrics_test.go @@ -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/shard" "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" "github.com/stretchr/testify/require" ) @@ -96,7 +96,7 @@ func TestCounters(t *testing.T) { require.Equal(t, mode.ReadWrite, mm.mode) const objNumber = 10 - oo := make([]*object.Object, objNumber) + oo := make([]*objectSDK.Object, objNumber) for i := 0; i < objNumber; i++ { oo[i] = testutil.GenerateObject() } @@ -240,7 +240,7 @@ func shardWithMetrics(t *testing.T, path string) (*shard.Shard, *metricsStore) { return sh, mm } -func addrFromObjs(oo []*object.Object) []oid.Address { +func addrFromObjs(oo []*objectSDK.Object) []oid.Address { aa := make([]oid.Address, len(oo)) for i := 0; i < len(oo); i++ { diff --git a/pkg/local_object_storage/shard/put.go b/pkg/local_object_storage/shard/put.go index 79dc4846..688b7aae 100644 --- a/pkg/local_object_storage/shard/put.go +++ b/pkg/local_object_storage/shard/put.go @@ -9,7 +9,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" "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/trace" "go.uber.org/zap" @@ -17,14 +17,14 @@ import ( // PutPrm groups the parameters of Put operation. type PutPrm struct { - obj *object.Object + obj *objectSDK.Object } // PutRes groups the resulting values of Put operation. type PutRes struct{} // 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 } diff --git a/pkg/local_object_storage/shard/range.go b/pkg/local_object_storage/shard/range.go index 362fd86c..e94482e3 100644 --- a/pkg/local_object_storage/shard/range.go +++ b/pkg/local_object_storage/shard/range.go @@ -10,7 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" @@ -29,7 +29,7 @@ type RngPrm struct { // RngRes groups the resulting values of GetRange operation. type RngRes struct { - obj *object.Object + obj *objectSDK.Object hasMeta bool } @@ -54,7 +54,7 @@ func (p *RngPrm) SetIgnoreMeta(ignore bool) { // Object returns the requested object part. // // 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 } @@ -71,7 +71,7 @@ func (r RngRes) HasMeta() bool { // 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.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. func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) { 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 } - cb := func(stor *blobstor.BlobStor, id []byte) (*object.Object, error) { + cb := func(stor *blobstor.BlobStor, id []byte) (*objectSDK.Object, error) { var getRngPrm common.GetRangePrm getRngPrm.Address = prm.addr getRngPrm.Range.SetOffset(prm.off) @@ -103,13 +103,13 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) { return nil, err } - obj := object.New() + obj := objectSDK.New() obj.SetPayload(res.Data) 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) if err != nil { return nil, err @@ -122,7 +122,7 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) { return nil, logicerr.Wrap(apistatus.ObjectOutOfRange{}) } - obj := object.New() + obj := objectSDK.New() obj.SetPayload(payload[from:to]) return obj, nil } diff --git a/pkg/local_object_storage/shard/select.go b/pkg/local_object_storage/shard/select.go index 2d4d473b..1615f5fb 100644 --- a/pkg/local_object_storage/shard/select.go +++ b/pkg/local_object_storage/shard/select.go @@ -7,7 +7,7 @@ import ( meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" @@ -16,7 +16,7 @@ import ( // SelectPrm groups the parameters of Select operation. type SelectPrm struct { cnr cid.ID - filters object.SearchFilters + filters objectSDK.SearchFilters } // 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. -func (p *SelectPrm) SetFilters(fs object.SearchFilters) { +func (p *SelectPrm) SetFilters(fs objectSDK.SearchFilters) { p.filters = fs } diff --git a/pkg/local_object_storage/shard/shard_test.go b/pkg/local_object_storage/shard/shard_test.go index 7b2fdb5d..a9a8e4ea 100644 --- a/pkg/local_object_storage/shard/shard_test.go +++ b/pkg/local_object_storage/shard/shard_test.go @@ -15,7 +15,7 @@ import ( "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/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" "github.com/panjf2000/ants/v2" "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.WithBlobovniczaShallowDepth(1), blobovniczatree.WithBlobovniczaShallowWidth(1)), - Policy: func(_ *object.Object, data []byte) bool { + Policy: func(_ *objectSDK.Object, data []byte) bool { return len(data) <= 1<<20 }, }, diff --git a/pkg/local_object_storage/util/splitinfo.go b/pkg/local_object_storage/util/splitinfo.go index 4a6d2226..6ae1c3e4 100644 --- a/pkg/local_object_storage/util/splitinfo.go +++ b/pkg/local_object_storage/util/splitinfo.go @@ -1,12 +1,12 @@ package util 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 // 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 if lp, ok := from.LastPart(); ok { diff --git a/pkg/local_object_storage/util/splitinfo_test.go b/pkg/local_object_storage/util/splitinfo_test.go index a0626db2..642fef3b 100644 --- a/pkg/local_object_storage/util/splitinfo_test.go +++ b/pkg/local_object_storage/util/splitinfo_test.go @@ -5,7 +5,7 @@ import ( "testing" "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" "github.com/google/uuid" "github.com/stretchr/testify/require" @@ -15,7 +15,7 @@ func TestMergeSplitInfo(t *testing.T) { uid, err := uuid.NewUUID() require.NoError(t, err) - splitID := object.NewSplitID() + splitID := objectSDK.NewSplitID() splitID.SetUUID(uid) var rawLinkID, rawLastID [32]byte @@ -30,35 +30,35 @@ func TestMergeSplitInfo(t *testing.T) { require.NoError(t, err) 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.SetLastPart(lastID) target.SetLink(linkID) t.Run("merge empty", func(t *testing.T) { - to := object.NewSplitInfo() + to := objectSDK.NewSplitInfo() result := util.MergeSplitInfo(target, to) require.Equal(t, result, target) }) t.Run("merge link", func(t *testing.T) { - from := object.NewSplitInfo() + from := objectSDK.NewSplitInfo() from.SetSplitID(splitID) from.SetLastPart(lastID) - to := object.NewSplitInfo() + to := objectSDK.NewSplitInfo() to.SetLink(linkID) result := util.MergeSplitInfo(from, to) require.Equal(t, result, target) }) t.Run("merge last", func(t *testing.T) { - from := object.NewSplitInfo() + from := objectSDK.NewSplitInfo() from.SetSplitID(splitID) from.SetLink(linkID) - to := object.NewSplitInfo() + to := objectSDK.NewSplitInfo() to.SetLastPart(lastID) result := util.MergeSplitInfo(from, to) diff --git a/pkg/local_object_storage/writecache/flush.go b/pkg/local_object_storage/writecache/flush.go index 21f968b0..779bac39 100644 --- a/pkg/local_object_storage/writecache/flush.go +++ b/pkg/local_object_storage/writecache/flush.go @@ -13,7 +13,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr" meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" "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" "github.com/mr-tron/base58" "github.com/nspcc-dev/neo-go/pkg/util/slice" @@ -129,7 +129,7 @@ func (c *cache) flushSmallObjects() { var count int for i := range m { - obj := object.New() + obj := objectSDK.New() if err := obj.Unmarshal(m[i].data); err != nil { continue } @@ -201,7 +201,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error { return err } - var obj object.Object + var obj objectSDK.Object err = obj.Unmarshal(data) if err != nil { 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() { defer c.wg.Done() - var obj *object.Object + var obj *objectSDK.Object for { // Give priority to direct put. select { @@ -251,7 +251,7 @@ func (c *cache) workerFlushSmall() { } // 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 defer func() { @@ -322,7 +322,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error { return err } - var obj object.Object + var obj objectSDK.Object if err := obj.Unmarshal(data); err != nil { c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err)) if ignoreErrors { diff --git a/pkg/local_object_storage/writecache/flush_test.go b/pkg/local_object_storage/writecache/flush_test.go index e8224ce5..2223bef0 100644 --- a/pkg/local_object_storage/writecache/flush_test.go +++ b/pkg/local_object_storage/writecache/flush_test.go @@ -16,7 +16,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" checksumtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum/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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" usertest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user/test" @@ -28,7 +28,7 @@ import ( type objectPair struct { addr oid.Address - obj *object.Object + obj *objectSDK.Object } 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) { - obj := object.New() +func newObject(t *testing.T, size int) (*objectSDK.Object, []byte) { + obj := objectSDK.New() ver := versionSDK.Current() obj.SetID(oidtest.ID()) obj.SetOwnerID(usertest.ID()) obj.SetContainerID(cidtest.ID()) - obj.SetType(object.TypeRegular) + obj.SetType(objectSDK.TypeRegular) obj.SetVersion(&ver) obj.SetPayloadChecksum(checksumtest.Checksum()) obj.SetPayloadHomomorphicHash(checksumtest.Checksum()) diff --git a/pkg/local_object_storage/writecache/writecache.go b/pkg/local_object_storage/writecache/writecache.go index 962c9c39..067ff5ae 100644 --- a/pkg/local_object_storage/writecache/writecache.go +++ b/pkg/local_object_storage/writecache/writecache.go @@ -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/shard/mode" "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" "go.etcd.io/bbolt" "go.uber.org/zap" @@ -24,8 +24,8 @@ type Info struct { // Cache represents write-cache for objects. type Cache interface { - Get(ctx context.Context, address oid.Address) (*object.Object, error) - Head(context.Context, oid.Address) (*object.Object, error) + Get(ctx context.Context, address oid.Address) (*objectSDK.Object, error) + Head(context.Context, oid.Address) (*objectSDK.Object, error) // Delete removes object referenced by the given oid.Address from the // Cache. Returns any error encountered that prevented the object to be // removed. @@ -58,7 +58,7 @@ type cache struct { compressFlags map[string]struct{} // flushCh is a channel with objects to flush. - flushCh chan *object.Object + flushCh chan *objectSDK.Object // closeCh is close channel, protected by modeMtx. closeCh chan struct{} // wg is a wait group for flush workers. @@ -75,7 +75,7 @@ const wcStorageType = "write-cache" type objectInfo struct { addr string data []byte - obj *object.Object + obj *objectSDK.Object } const ( @@ -91,7 +91,7 @@ var ( // New creates new writecache instance. func New(opts ...Option) Cache { c := &cache{ - flushCh: make(chan *object.Object), + flushCh: make(chan *objectSDK.Object), mode: mode.ReadWrite, compressFlags: make(map[string]struct{}), diff --git a/pkg/network/cache/multi.go b/pkg/network/cache/multi.go index b7f7dc20..18155849 100644 --- a/pkg/network/cache/multi.go +++ b/pkg/network/cache/multi.go @@ -13,7 +13,7 @@ import ( metrics "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics/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/object" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "google.golang.org/grpc" "google.golang.org/grpc/codes" "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 // from the SDK client; should not be considered // as a connection error - var siErr *object.SplitInfoError + var siErr *objectSDK.SplitInfoError success := err == nil || errors.Is(err, context.Canceled) || errors.As(err, &siErr) 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 // from the SDK client; should not be considered // as a connection error - var siErr *object.SplitInfoError + var siErr *objectSDK.SplitInfoError if errors.As(err, &siErr) { return } diff --git a/pkg/services/object/acl/eacl/v2/eacl_test.go b/pkg/services/object/acl/eacl/v2/eacl_test.go index ce5d98d5..6f879123 100644 --- a/pkg/services/object/acl/eacl/v2/eacl_test.go +++ b/pkg/services/object/acl/eacl/v2/eacl_test.go @@ -10,7 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" 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" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" @@ -22,12 +22,12 @@ type testLocalStorage struct { expAddr oid.Address - obj *object.Object + obj *objectSDK.Object 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.Object().Equals(s.expAddr.Object())) @@ -69,11 +69,11 @@ func TestHeadRequest(t *testing.T) { meta.SetXHeaders(xHdrs) - obj := object.New() + obj := objectSDK.New() attrKey := "attr_key" attrVal := "attr_val" - var attr object.Attribute + var attr objectSDK.Attribute attr.SetKey(attrKey) attr.SetValue(attrVal) obj.SetAttributes(attr) diff --git a/pkg/services/object/acl/eacl/v2/headers.go b/pkg/services/object/acl/eacl/v2/headers.go index 09581084..c7a1b772 100644 --- a/pkg/services/object/acl/eacl/v2/headers.go +++ b/pkg/services/object/acl/eacl/v2/headers.go @@ -11,7 +11,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" 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" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" ) @@ -28,7 +28,7 @@ type cfg struct { } type ObjectStorage interface { - Head(context.Context, oid.Address) (*object.Object, error) + Head(context.Context, oid.Address) (*objectSDK.Object, error) } type Request interface { @@ -141,7 +141,7 @@ func (h *cfg) readObjectHeadersFromRequestXHeaderSource(m requestXHeaderSource, oV2.SetObjectID(v.GetObjectID()) 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: cnrV2 := req.GetBody().GetContainerID() @@ -171,7 +171,7 @@ func (h *cfg) readObjectHeadersResponseXHeaderSource(m responseXHeaderSource, ds oV2.SetObjectID(v.GetObjectID()) 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: oV2 := new(objectV2.Object) @@ -197,7 +197,7 @@ func (h *cfg) readObjectHeadersResponseXHeaderSource(m responseXHeaderSource, ds 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 } diff --git a/pkg/services/object/acl/eacl/v2/object.go b/pkg/services/object/acl/eacl/v2/object.go index 0a63981c..690e4aa7 100644 --- a/pkg/services/object/acl/eacl/v2/object.go +++ b/pkg/services/object/acl/eacl/v2/object.go @@ -6,7 +6,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" 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" ) @@ -26,7 +26,7 @@ func u64Value(v uint64) string { 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 for obj := obj; obj != nil; obj = obj.Parent() { count += 9 + len(obj.Attributes()) diff --git a/pkg/services/object/delete/exec.go b/pkg/services/object/delete/exec.go index 343efbc0..b10f045e 100644 --- a/pkg/services/object/delete/exec.go +++ b/pkg/services/object/delete/exec.go @@ -10,7 +10,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" apiclient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" 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" "go.uber.org/zap" ) @@ -29,11 +29,11 @@ type execCtx struct { log *logger.Logger - tombstone *object.Tombstone + tombstone *objectSDK.Tombstone - splitInfo *object.SplitInfo + splitInfo *objectSDK.SplitInfo - tombstoneObj *object.Object + tombstoneObj *objectSDK.Object } const ( @@ -241,9 +241,9 @@ func (exec *execCtx) initTombstoneObject() bool { return false } - exec.tombstoneObj = object.New() + exec.tombstoneObj = objectSDK.New() exec.tombstoneObj.SetContainerID(exec.containerID()) - exec.tombstoneObj.SetType(object.TypeTombstone) + exec.tombstoneObj.SetType(objectSDK.TypeTombstone) exec.tombstoneObj.SetPayload(payload) tokenSession := exec.commonParameters().SessionToken() @@ -256,7 +256,7 @@ func (exec *execCtx) initTombstoneObject() bool { exec.tombstoneObj.SetOwnerID(&localUser) } - var a object.Attribute + var a objectSDK.Attribute a.SetKey(objectV2.SysAttributeExpEpoch) a.SetValue(strconv.FormatUint(exec.tombstone.ExpirationEpoch(), 10)) diff --git a/pkg/services/object/delete/local.go b/pkg/services/object/delete/local.go index 34839b19..ad3e10bc 100644 --- a/pkg/services/object/delete/local.go +++ b/pkg/services/object/delete/local.go @@ -4,7 +4,7 @@ import ( "context" "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" "go.uber.org/zap" ) @@ -35,7 +35,7 @@ func (exec *execCtx) formTombstone(ctx context.Context) (ok bool) { return false } - exec.tombstone = object.NewTombstone() + exec.tombstone = objectSDK.NewTombstone() exec.tombstone.SetExpirationEpoch( exec.svc.netInfo.CurrentEpoch() + tsLifetime, ) diff --git a/pkg/services/object/delete/service.go b/pkg/services/object/delete/service.go index 11ff13b4..5c09ad12 100644 --- a/pkg/services/object/delete/service.go +++ b/pkg/services/object/delete/service.go @@ -9,7 +9,7 @@ import ( 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/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" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "go.uber.org/zap" @@ -41,7 +41,7 @@ type cfg struct { header interface { // 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) @@ -85,7 +85,7 @@ func New(opts ...Option) *Service { // WithLogger returns option to specify Delete service's logger. func WithLogger(l *logger.Logger) Option { 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"))} } } diff --git a/pkg/services/object/delete/util.go b/pkg/services/object/delete/util.go index f6341f02..b8e8e632 100644 --- a/pkg/services/object/delete/util.go +++ b/pkg/services/object/delete/util.go @@ -7,7 +7,7 @@ import ( getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" putsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/put" 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" ) @@ -21,7 +21,7 @@ type simpleIDWriter struct { 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() p := getsvc.HeadPrm{} @@ -38,10 +38,10 @@ func (w *headSvcWrapper) headAddress(ctx context.Context, exec *execCtx, addr oi 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()) - var errSplitInfo *object.SplitInfoError + var errSplitInfo *objectSDK.SplitInfoError switch { 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) { - fs := object.SearchFilters{} - fs.AddSplitIDFilter(object.MatchStringEqual, exec.splitInfo.SplitID()) + fs := objectSDK.SearchFilters{} + fs.AddSplitIDFilter(objectSDK.MatchStringEqual, exec.splitInfo.SplitID()) wr := new(simpleIDWriter) diff --git a/pkg/services/object/get/get.go b/pkg/services/object/get/get.go index 457193a5..e3037a70 100644 --- a/pkg/services/object/get/get.go +++ b/pkg/services/object/get/get.go @@ -5,7 +5,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "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" ) @@ -74,7 +74,7 @@ func (s *Service) get(ctx context.Context, prm RequestParameters) error { localStorage: s.localStorage, prm: prm, - infoSplit: object.NewSplitInfo(), + infoSplit: objectSDK.NewSplitInfo(), } exec.setLogger(s.log) diff --git a/pkg/services/object/get/v2/get_forwarder.go b/pkg/services/object/get/v2/get_forwarder.go index 580c0b58..40aa3f62 100644 --- a/pkg/services/object/get/v2/get_forwarder.go +++ b/pkg/services/object/get/v2/get_forwarder.go @@ -17,7 +17,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" "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/trace" ) @@ -31,7 +31,7 @@ type getRequestForwarder struct { 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", trace.WithAttributes(attribute.String("address", addr.String())), ) @@ -85,7 +85,7 @@ func (f *getRequestForwarder) writeHeader(ctx context.Context, v *objectV2.GetOb var err error f.OnceHeaderSending.Do(func() { - err = f.Stream.WriteHeader(ctx, object.NewFromV2(obj)) + err = f.Stream.WriteHeader(ctx, objectSDK.NewFromV2(obj)) }) if err != nil { return errCouldNotWriteObjHeader(err) @@ -164,8 +164,8 @@ func (f *getRequestForwarder) readStream(ctx context.Context, c client.MultiAddr localProgress += len(origChunk) f.GlobalProgress += len(chunk) case *objectV2.SplitInfo: - si := object.NewSplitInfoFromV2(v) - return object.NewSplitInfoError(si) + si := objectSDK.NewSplitInfoFromV2(v) + return objectSDK.NewSplitInfoError(si) } } return nil diff --git a/pkg/services/object/get/v2/get_range_forwarder.go b/pkg/services/object/get/v2/get_range_forwarder.go index 7858e2b5..8a56c59a 100644 --- a/pkg/services/object/get/v2/get_range_forwarder.go +++ b/pkg/services/object/get/v2/get_range_forwarder.go @@ -17,7 +17,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal" internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal/client" "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/trace" ) @@ -30,7 +30,7 @@ type getRangeRequestForwarder struct { 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", trace.WithAttributes(attribute.String("address", addr.String())), ) @@ -130,8 +130,8 @@ func (f *getRangeRequestForwarder) readStream(ctx context.Context, rangeStream * localProgress += len(origChunk) f.GlobalProgress += len(chunk) case *objectV2.SplitInfo: - si := object.NewSplitInfoFromV2(v) - return object.NewSplitInfoError(si) + si := objectSDK.NewSplitInfoFromV2(v) + return objectSDK.NewSplitInfoError(si) } } return nil diff --git a/pkg/services/object/get/v2/head_forwarder.go b/pkg/services/object/get/v2/head_forwarder.go index fa150643..a1bce151 100644 --- a/pkg/services/object/get/v2/head_forwarder.go +++ b/pkg/services/object/get/v2/head_forwarder.go @@ -16,7 +16,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/internal" "git.frostfs.info/TrueCloudLab/frostfs-observability/tracing" 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" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" @@ -30,7 +30,7 @@ type headRequestForwarder struct { 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", trace.WithAttributes(attribute.String("address", addr.String())), ) @@ -82,15 +82,15 @@ func (f *headRequestForwarder) forwardRequestToNode(ctx context.Context, addr ne return nil, err } case *objectV2.SplitInfo: - si := object.NewSplitInfoFromV2(v) - return nil, object.NewSplitInfoError(si) + si := objectSDK.NewSplitInfoFromV2(v) + return nil, objectSDK.NewSplitInfoError(si) } objv2 := new(objectV2.Object) objv2.SetHeader(hdr) objv2.SetSignature(idSig) - obj := object.NewFromV2(objv2) + obj := objectSDK.NewFromV2(objv2) obj.SetID(f.ObjectAddr.Object()) return obj, nil diff --git a/pkg/services/object/get/v2/service.go b/pkg/services/object/get/v2/service.go index 1bd8befa..d4bce178 100644 --- a/pkg/services/object/get/v2/service.go +++ b/pkg/services/object/get/v2/service.go @@ -8,7 +8,7 @@ import ( objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object" getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" 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. @@ -47,7 +47,7 @@ func (s *Service) Get(req *objectV2.GetRequest, stream objectSvc.GetObjectStream err = s.svc.Get(stream.Context(), *p) - var splitErr *object.SplitInfoError + var splitErr *objectSDK.SplitInfoError switch { 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) - var splitErr *object.SplitInfoError + var splitErr *objectSDK.SplitInfoError switch { 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) - var splitErr *object.SplitInfoError + var splitErr *objectSDK.SplitInfoError if errors.As(err, &splitErr) { setSplitInfoHeadResponse(splitErr.SplitInfo(), resp) diff --git a/pkg/services/object/get/v2/streamer.go b/pkg/services/object/get/v2/streamer.go index 4347ef41..ce9a5c76 100644 --- a/pkg/services/object/get/v2/streamer.go +++ b/pkg/services/object/get/v2/streamer.go @@ -5,7 +5,7 @@ import ( objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/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 { @@ -16,7 +16,7 @@ type streamObjectRangeWriter struct { 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) objV2 := obj.ToV2() diff --git a/pkg/services/object/get/v2/util.go b/pkg/services/object/get/v2/util.go index 519d9afa..9ecc9167 100644 --- a/pkg/services/object/get/v2/util.go +++ b/pkg/services/object/get/v2/util.go @@ -16,7 +16,7 @@ import ( getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" 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" versionSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version" "git.frostfs.info/TrueCloudLab/tzhash/tz" @@ -98,7 +98,7 @@ func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.Get p.WithAddress(addr) p.WithRawFlag(body.GetRaw()) p.SetChunkWriter(streamWrapper) - p.SetRange(object.NewRangeFromV2(body.GetRange())) + p.SetRange(objectSDK.NewRangeFromV2(body.GetRange())) err = p.Validate() if err != nil { @@ -167,10 +167,10 @@ func (s *Service) toHashRangePrm(req *objectV2.GetRangeHashRequest) (*getsvc.Ran } rngsV2 := body.GetRanges() - rngs := make([]object.Range, len(rngsV2)) + rngs := make([]objectSDK.Range, len(rngsV2)) for i := range rngsV2 { - rngs[i] = *object.NewRangeFromV2(&rngsV2[i]) + rngs[i] = *objectSDK.NewRangeFromV2(&rngsV2[i]) } p.SetRangeList(rngs) @@ -198,7 +198,7 @@ type headResponseWriter struct { 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 { w.body.SetHeaderPart(toShortObjectHeader(hdr)) } else { @@ -259,7 +259,7 @@ func (s *Service) toHeadPrm(req *objectV2.HeadRequest, resp *objectV2.HeadRespon return p, nil } -func splitInfoResponse(info *object.SplitInfo) *objectV2.GetResponse { +func splitInfoResponse(info *objectSDK.SplitInfo) *objectV2.GetResponse { resp := new(objectV2.GetResponse) body := new(objectV2.GetResponseBody) @@ -270,7 +270,7 @@ func splitInfoResponse(info *object.SplitInfo) *objectV2.GetResponse { return resp } -func splitInfoRangeResponse(info *object.SplitInfo) *objectV2.GetRangeResponse { +func splitInfoRangeResponse(info *objectSDK.SplitInfo) *objectV2.GetRangeResponse { resp := new(objectV2.GetRangeResponse) body := new(objectV2.GetRangeResponseBody) @@ -281,7 +281,7 @@ func splitInfoRangeResponse(info *object.SplitInfo) *objectV2.GetRangeResponse { return resp } -func setSplitInfoHeadResponse(info *object.SplitInfo, resp *objectV2.HeadResponse) { +func setSplitInfoHeadResponse(info *objectSDK.SplitInfo, resp *objectV2.HeadResponse) { resp.GetBody().SetHeaderPart(info.ToV2()) } @@ -297,7 +297,7 @@ func toHashResponse(typ refs.ChecksumType, res *getsvc.RangeHashRes) *objectV2.G return resp } -func toFullObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { +func toFullObjectHeader(hdr *objectSDK.Object) objectV2.GetHeaderPart { obj := hdr.ToV2() hs := new(objectV2.HeaderWithSignature) @@ -307,7 +307,7 @@ func toFullObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { return hs } -func toShortObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { +func toShortObjectHeader(hdr *objectSDK.Object) objectV2.GetHeaderPart { hdrV2 := hdr.ToV2().GetHeader() sh := new(objectV2.ShortHeader) @@ -322,11 +322,11 @@ func toShortObjectHeader(hdr *object.Object) objectV2.GetHeaderPart { return sh } -func groupAddressRequestForwarder(f func(context.Context, network.Address, client.MultiAddressClient, []byte) (*object.Object, error)) getsvc.RequestForwarder { - return func(ctx context.Context, info client.NodeInfo, c client.MultiAddressClient) (*object.Object, error) { +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) (*objectSDK.Object, error) { var ( firstErr error - res *object.Object + res *objectSDK.Object key = info.PublicKey() ) diff --git a/pkg/services/object/get/writer.go b/pkg/services/object/get/writer.go index 78af5db4..1b842ade 100644 --- a/pkg/services/object/get/writer.go +++ b/pkg/services/object/get/writer.go @@ -4,7 +4,7 @@ import ( "context" "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 @@ -16,7 +16,7 @@ type ChunkWriter interface { // HeaderWriter is an interface of target component // to write object header. 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. @@ -26,7 +26,7 @@ type ObjectWriter interface { } type SimpleObjectWriter struct { - obj *object.Object + obj *objectSDK.Object pld []byte } @@ -45,11 +45,11 @@ type hasherWrapper struct { func NewSimpleObjectWriter() *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.pld = make([]byte, 0, obj.PayloadSize()) @@ -62,7 +62,7 @@ func (s *SimpleObjectWriter) WriteChunk(_ context.Context, p []byte) error { return nil } -func (s *SimpleObjectWriter) Object() *object.Object { +func (s *SimpleObjectWriter) Object() *objectSDK.Object { if len(s.pld) > 0 { 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) } -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) } diff --git a/pkg/services/object/head/remote.go b/pkg/services/object/head/remote.go index bcba181f..c9c17d4d 100644 --- a/pkg/services/object/head/remote.go +++ b/pkg/services/object/head/remote.go @@ -10,7 +10,7 @@ import ( 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-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" ) @@ -64,7 +64,7 @@ func (p *RemoteHeadPrm) WithObjectAddress(v oid.Address) *RemoteHeadPrm { } // 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) if err != nil { return nil, fmt.Errorf("(%T) could not receive private key: %w", h, err) diff --git a/pkg/services/object/internal/client/client.go b/pkg/services/object/internal/client/client.go index a54f6cd0..cfab77ef 100644 --- a/pkg/services/object/internal/client/client.go +++ b/pkg/services/object/internal/client/client.go @@ -14,7 +14,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session" ) @@ -77,7 +77,7 @@ type readPrmCommon struct { 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. func (x *readPrmCommon) SetNetmapEpoch(_ uint64) { @@ -111,11 +111,11 @@ func (x *GetObjectPrm) SetAddress(addr oid.Address) { // GetObjectRes groups the resulting values of GetObject operation. type GetObjectRes struct { - obj *object.Object + obj *objectSDK.Object } -// Object returns requested object. -func (x GetObjectRes) Object() *object.Object { +// Object returns requested objectSDK. +func (x GetObjectRes) Object() *objectSDK.Object { 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: -// - 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. // -// 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) { // here we ignore session if it is opened for other object since such // 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) } - var obj object.Object + var obj objectSDK.Object if !rdr.ReadHeader(&obj) { res, err := rdr.Close() @@ -210,11 +210,11 @@ func (x *HeadObjectPrm) SetAddress(addr oid.Address) { // HeadObjectRes groups the resulting values of GetObject operation. type HeadObjectRes struct { - hdr *object.Object + hdr *objectSDK.Object } // Header returns requested object header. -func (x HeadObjectRes) Header() *object.Object { +func (x HeadObjectRes) Header() *objectSDK.Object { 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: // -// 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. // -// 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) { if prm.local { 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) } - var hdr object.Object + var hdr objectSDK.Object if !cliRes.ReadHeader(&hdr) { 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. // // Required parameter. -func (x *PayloadRangePrm) SetRange(rng *object.Range) { +func (x *PayloadRangePrm) SetRange(rng *objectSDK.Range) { x.cliPrm.SetOffset(rng.GetOffset()) 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: // -// 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.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) { if prm.local { prm.cliPrm.MarkLocal() @@ -377,13 +377,13 @@ func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, e type PutObjectPrm struct { commonPrm - obj *object.Object + obj *objectSDK.Object } // SetObject sets object to be stored. // // Required parameter. -func (x *PutObjectPrm) SetObject(obj *object.Object) { +func (x *PutObjectPrm) SetObject(obj *objectSDK.Object) { x.obj = obj } @@ -392,7 +392,7 @@ type PutObjectRes struct { id oid.ID } -// ID returns identifier of the stored object. +// ID returns identifier of the stored objectSDK. func (x PutObjectRes) ID() oid.ID { return x.id } @@ -464,7 +464,7 @@ func (x *SearchObjectsPrm) SetContainerID(id cid.ID) { } // SetFilters sets search filters. -func (x *SearchObjectsPrm) SetFilters(fs object.SearchFilters) { +func (x *SearchObjectsPrm) SetFilters(fs objectSDK.SearchFilters) { x.cliPrm.SetFilters(fs) } diff --git a/pkg/services/object/put/local.go b/pkg/services/object/put/local.go index f0712272..be202892 100644 --- a/pkg/services/object/put/local.go +++ b/pkg/services/object/put/local.go @@ -5,7 +5,7 @@ import ( "fmt" 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" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer" ) @@ -14,7 +14,7 @@ import ( type ObjectStorage interface { // Put must save passed object // and return any appeared error. - Put(context.Context, *object.Object) error + Put(context.Context, *objectSDK.Object) error // Delete must delete passed objects // and return any appeared error. Delete(ctx context.Context, tombstone oid.Address, toDelete []oid.ID) error @@ -28,11 +28,11 @@ type ObjectStorage interface { type localTarget struct { storage ObjectStorage - obj *object.Object + obj *objectSDK.Object 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.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) { switch t.meta.Type() { - case object.TypeTombstone: + case objectSDK.TypeTombstone: err := t.storage.Delete(ctx, objectCore.AddressOf(t.obj), t.meta.Objects()) if err != nil { 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()) if err != nil { return nil, fmt.Errorf("could not lock object from lock objects locally: %w", err) diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go index c8d1b29a..52a7c102 100644 --- a/pkg/services/object/put/prm.go +++ b/pkg/services/object/put/prm.go @@ -7,13 +7,13 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement" 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 { common *util.CommonPrm - hdr *object.Object + hdr *objectSDK.Object cnr containerSDK.Container @@ -34,7 +34,7 @@ func (p *PutInitPrm) WithCommonPrm(v *util.CommonPrm) *PutInitPrm { return p } -func (p *PutInitPrm) WithObject(v *object.Object) *PutInitPrm { +func (p *PutInitPrm) WithObject(v *objectSDK.Object) *PutInitPrm { if p != nil { p.hdr = v } diff --git a/pkg/services/object/put/remote.go b/pkg/services/object/put/remote.go index bcc566b7..a5b3f643 100644 --- a/pkg/services/object/put/remote.go +++ b/pkg/services/object/put/remote.go @@ -11,7 +11,7 @@ import ( 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-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" ) @@ -22,7 +22,7 @@ type remoteTarget struct { nodeInfo clientcore.NodeInfo - obj *object.Object + obj *objectSDK.Object clientConstructor ClientConstructor } @@ -39,10 +39,10 @@ type RemoteSender struct { type RemotePutPrm struct { 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 return nil @@ -89,7 +89,7 @@ func (p *RemotePutPrm) WithNodeInfo(v netmap.NodeInfo) *RemotePutPrm { } // WithObject sets transferred object. -func (p *RemotePutPrm) WithObject(v *object.Object) *RemotePutPrm { +func (p *RemotePutPrm) WithObject(v *objectSDK.Object) *RemotePutPrm { if p != nil { p.obj = v } diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 8be9c75a..bf6c2058 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -12,7 +12,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement" pkgutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util" 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/user" ) @@ -212,7 +212,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { // enable additional container broadcast on non-local operation // if object has TOMBSTONE or LOCK 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{ traversal: traversal{ diff --git a/pkg/services/object/put/v2/util.go b/pkg/services/object/put/v2/util.go index 758470f6..a157a954 100644 --- a/pkg/services/object/put/v2/util.go +++ b/pkg/services/object/put/v2/util.go @@ -5,7 +5,7 @@ import ( refsV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" 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-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) { @@ -21,7 +21,7 @@ func (s *streamer) toInitPrm(part *objectV2.PutObjectPartInit, req *objectV2.Put return new(putsvc.PutInitPrm). WithObject( - object.NewFromV2(oV2), + objectSDK.NewFromV2(oV2), ). WithRelay(s.relayRequest). WithCommonPrm(commonPrm). diff --git a/pkg/services/object/search/exec.go b/pkg/services/object/search/exec.go index 475a31b9..c1a9a0c1 100644 --- a/pkg/services/object/search/exec.go +++ b/pkg/services/object/search/exec.go @@ -5,7 +5,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" 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" "go.uber.org/zap" ) @@ -56,7 +56,7 @@ func (exec *execCtx) containerID() cid.ID { return exec.prm.cnr } -func (exec *execCtx) searchFilters() object.SearchFilters { +func (exec *execCtx) searchFilters() objectSDK.SearchFilters { return exec.prm.filters } diff --git a/pkg/services/object/search/prm.go b/pkg/services/object/search/prm.go index da46dfeb..d2918d6e 100644 --- a/pkg/services/object/search/prm.go +++ b/pkg/services/object/search/prm.go @@ -6,7 +6,7 @@ import ( coreclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" 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" ) @@ -18,7 +18,7 @@ type Prm struct { cnr cid.ID - filters object.SearchFilters + filters objectSDK.SearchFilters forwarder RequestForwarder } @@ -55,6 +55,6 @@ func (p *Prm) WithContainerID(id cid.ID) { } // WithSearchFilters sets search filters. -func (p *Prm) WithSearchFilters(fs object.SearchFilters) { +func (p *Prm) WithSearchFilters(fs objectSDK.SearchFilters) { p.filters = fs } diff --git a/pkg/services/object/search/v2/util.go b/pkg/services/object/search/v2/util.go index cfccaede..e971fa8e 100644 --- a/pkg/services/object/search/v2/util.go +++ b/pkg/services/object/search/v2/util.go @@ -12,7 +12,7 @@ import ( searchsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/search" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" 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" ) @@ -58,7 +58,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre } p.WithContainerID(id) - p.WithSearchFilters(object.NewSearchFiltersFromV2(body.GetFilters())) + p.WithSearchFilters(objectSDK.NewSearchFiltersFromV2(body.GetFilters())) return p, nil } diff --git a/pkg/services/object/util/chain.go b/pkg/services/object/util/chain.go index 96dafd10..b574d5eb 100644 --- a/pkg/services/object/util/chain.go +++ b/pkg/services/object/util/chain.go @@ -5,7 +5,7 @@ import ( "fmt" 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" ) @@ -22,11 +22,11 @@ type HeadReceiver interface { // // If reverseDirection arg is true, then the traversal is done in reverse order. // 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. -func IterateAllSplitLeaves(r HeadReceiver, addr oid.Address, h func(*object.Object)) error { - return IterateSplitLeaves(r, addr, func(leaf *object.Object) bool { +func IterateAllSplitLeaves(r HeadReceiver, addr oid.Address, h func(*objectSDK.Object)) error { + return IterateSplitLeaves(r, addr, func(leaf *objectSDK.Object) bool { h(leaf) 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. // // 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 ( 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 if reverse { @@ -84,9 +84,9 @@ func traverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler) switch res := v.(type) { default: panic(fmt.Sprintf("unexpected result of %T: %T", r, v)) - case *object.Object: + case *objectSDK.Object: return h(res, false), nil - case *object.SplitInfo: + case *objectSDK.SplitInfo: link, withLink := res.Link() 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) - 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() if reverseDirection { @@ -122,12 +122,12 @@ func traverseByLink(cnr cid.ID, link oid.ID, r HeadReceiver, h SplitMemberHandle return false, err } - var reverseChain []*object.Object + var reverseChain []*objectSDK.Object for i := range chain { 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 { return h(member, false) } @@ -147,16 +147,16 @@ func traverseByLink(cnr cid.ID, link oid.ID, r HeadReceiver, h SplitMemberHandle 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 addr.SetContainer(cnr) for last, withLast = res.LastPart(); withLast; { 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 { last, withLast = member.PreviousID() return h(member, true) diff --git a/pkg/services/object_manager/tombstone/checker.go b/pkg/services/object_manager/tombstone/checker.go index 46fcc984..66a0ec7d 100644 --- a/pkg/services/object_manager/tombstone/checker.go +++ b/pkg/services/object_manager/tombstone/checker.go @@ -7,7 +7,7 @@ import ( objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" "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" lru "github.com/hashicorp/golang-lru/v2" "go.uber.org/zap" @@ -21,7 +21,7 @@ type Source interface { // // Tombstone MUST return (nil, nil) if requested tombstone is // 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. @@ -72,7 +72,7 @@ func (g *ExpirationChecker) IsTombstoneAvailable(ctx context.Context, a oid.Addr 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() { if atr.Key() == objectV2.SysAttributeExpEpoch || atr.Key() == objectV2.SysAttributeExpEpochNeoFS { epoch, err := strconv.ParseUint(atr.Value(), 10, 64) diff --git a/pkg/services/policer/check.go b/pkg/services/policer/check.go index db297b68..a45c019e 100644 --- a/pkg/services/policer/check.go +++ b/pkg/services/policer/check.go @@ -11,7 +11,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" 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/object" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "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. var uncheckedCopies int - if typ == object.TypeLock { + if typ == objectSDK.TypeLock { // all nodes of a container must store the `LOCK` objects // for correct object removal protection: // - `LOCK` objects are broadcast on their PUT requests; diff --git a/pkg/services/policer/policer_test.go b/pkg/services/policer/policer_test.go index a0995789..0ead48ef 100644 --- a/pkg/services/policer/policer_test.go +++ b/pkg/services/policer/policer_test.go @@ -14,7 +14,7 @@ import ( apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" 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/object" + objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test" "github.com/panjf2000/ants/v2" @@ -27,7 +27,7 @@ func TestBuryObjectWithoutContainer(t *testing.T) { objs := []objectcore.AddressWithType{ { 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 tests := []struct { desc string - objType object.Type + objType objectSDK.Type nodeCount int policy string placement [][]int @@ -128,7 +128,7 @@ func TestProcessObject(t *testing.T) { }, { desc: "lock object must be replicated to all nodes", - objType: object.TypeLock, + objType: objectSDK.TypeLock, nodeCount: 3, policy: `REP 1`, placement: [][]int{{0, 1, 2}}, @@ -176,7 +176,7 @@ func TestProcessObject(t *testing.T) { } // 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]) if a != addr || index < 1 || index >= ti.nodeCount { t.Errorf("unexpected remote object head: node=%+v addr=%v", ni, a)