diff --git a/go.mod b/go.mod index d600ded..f2f2616 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module git.frostfs.info/TrueCloudLab/frostfs-sdk-go go 1.20 +replace git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240427200446-67c6f305b21f => git.frostfs.info/aarifullin/frostfs-api-go/v2 v2.15.1-0.20240503124453-87caff9c8df0 + require ( git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240427200446-67c6f305b21f git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb diff --git a/go.sum b/go.sum index 754d2d7..cbb4019 100644 --- a/go.sum +++ b/go.sum @@ -31,10 +31,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240422151450-df9b65324a4c h1:RFDrNsF2e+EJfaB8lZrRRxNjQkLfM09gnEyudvGuc10= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240422151450-df9b65324a4c/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240427200446-67c6f305b21f h1:YyjsQNtrngQzIKOUtApXoi5r5pewatM+cXfpY19vZWo= -git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240427200446-67c6f305b21f/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M= git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o= git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk= @@ -45,6 +41,8 @@ git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9m git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc= git.frostfs.info/TrueCloudLab/tzhash v1.8.0 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA= git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8= +git.frostfs.info/aarifullin/frostfs-api-go/v2 v2.15.1-0.20240503124453-87caff9c8df0 h1:20DrUE/PcqDbEbW4EIoE4qi+Dm9Il4tE0RoHitYiIB8= +git.frostfs.info/aarifullin/frostfs-api-go/v2 v2.15.1-0.20240503124453-87caff9c8df0/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1:MJCkWUBhi9pn/CrYO1Q3P687y2KeahrOPS9BD9LDGb0= diff --git a/object/erasurecode/split.go b/object/erasurecode/split.go index 196de4a..4fb0b1b 100644 --- a/object/erasurecode/split.go +++ b/object/erasurecode/split.go @@ -32,6 +32,13 @@ func (c *Constructor) Split(obj *objectSDK.Object, key *ecdsa.PrivateKey) ([]*ob chunk.SetPayload(payloadShards[i]) chunk.SetPayloadSize(uint64(len(payloadShards[i]))) + if obj.SplitID() != nil { + var attr objectSDK.Attribute + attr.SetKey("split") + attr.SetValue("true") + chunk.SetAttributes(attr) + } + ec := objectSDK.NewECHeader(parent, uint32(i), uint32(len(payloadShards)), headerShards[i], uint32(len(header))) chunk.SetECHeader(ec) if err := setIDWithSignature(chunk, key); err != nil { diff --git a/object/search.go b/object/search.go index f3df671..818099d 100644 --- a/object/search.go +++ b/object/search.go @@ -120,6 +120,7 @@ const ( fKeySplitID fKeyPropRoot fKeyPropPhy + fKeyECParent ) func (k filterKey) String() string { @@ -152,6 +153,8 @@ func (k filterKey) String() string { return v2object.FilterPropertyRoot case fKeyPropPhy: return v2object.FilterPropertyPhy + case fKeyECParent: + return v2object.FilterHeaderECParent } } @@ -277,6 +280,10 @@ func (f *SearchFilters) AddSplitIDFilter(m SearchMatchType, id *SplitID) { f.addReservedFilter(m, fKeySplitID, staticStringer(id.String())) } +func (f *SearchFilters) AddECParentFilter(m SearchMatchType, parentID oid.ID) { + f.addReservedFilter(m, fKeyECParent, staticStringer(parentID.String())) +} + // AddTypeFilter adds filter by object type. func (f *SearchFilters) AddTypeFilter(m SearchMatchType, typ Type) { f.addReservedFilter(m, fKeyType, staticStringer(typ.String())) diff --git a/object/search_test.go b/object/search_test.go index 40df23b..4241f7d 100644 --- a/object/search_test.go +++ b/object/search_test.go @@ -160,6 +160,23 @@ func TestSearchFilters_AddSplitIDFilter(t *testing.T) { }) } +func TestSearchFilters_AddECParentFilter(t *testing.T) { + id := testOID() + + fs := new(object.SearchFilters) + fs.AddECParentFilter(object.MatchStringEqual, id) + + t.Run("v2", func(t *testing.T) { + fsV2 := fs.ToV2() + + require.Len(t, fsV2, 1) + + require.Equal(t, v2object.FilterHeaderECParent, fsV2[0].GetKey()) + require.Equal(t, id.String(), fsV2[0].GetValue()) + require.Equal(t, v2object.MatchStringEqual, fsV2[0].GetMatchType()) + }) +} + func TestSearchFilters_AddTypeFilter(t *testing.T) { typ := object.TypeTombstone