[#XX] types: Refactor imported SDK and API types
Some checks failed
ci/woodpecker/pr/pre-commit Pipeline was successful
Build / Build Components (1.19) (pull_request) Successful in 2m45s
Build / Build Components (1.20) (pull_request) Successful in 8m1s
Tests and linters / Tests (1.19) (pull_request) Failing after 3m0s
Tests and linters / Tests (1.20) (pull_request) Failing after 3m20s
Tests and linters / Lint (pull_request) Failing after 9m45s
Tests and linters / Tests with -race (pull_request) Failing after 4m38s
Tests and linters / Staticcheck (pull_request) Failing after 9m4s
Some checks failed
ci/woodpecker/pr/pre-commit Pipeline was successful
Build / Build Components (1.19) (pull_request) Successful in 2m45s
Build / Build Components (1.20) (pull_request) Successful in 8m1s
Tests and linters / Tests (1.19) (pull_request) Failing after 3m0s
Tests and linters / Tests (1.20) (pull_request) Failing after 3m20s
Tests and linters / Lint (pull_request) Failing after 9m45s
Tests and linters / Tests with -race (pull_request) Failing after 4m38s
Tests and linters / Staticcheck (pull_request) Failing after 9m4s
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
a65e26878b
commit
4cb9488a4a
188 changed files with 2282 additions and 1321 deletions
|
@ -6,6 +6,8 @@ WORKDIR /src
|
||||||
COPY . /src
|
COPY . /src
|
||||||
|
|
||||||
RUN make bin/frostfs-node
|
RUN make bin/frostfs-node
|
||||||
|
RUN make bin/frostfs-cli
|
||||||
|
RUN make bin/frostfs-adm
|
||||||
|
|
||||||
# Executable image
|
# Executable image
|
||||||
FROM alpine AS frostfs-node
|
FROM alpine AS frostfs-node
|
||||||
|
@ -14,5 +16,7 @@ RUN apk add --no-cache bash
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
COPY --from=builder /src/bin/frostfs-node /bin/frostfs-node
|
COPY --from=builder /src/bin/frostfs-node /bin/frostfs-node
|
||||||
|
COPY --from=builder /src/bin/frostfs-cli /bin/frostfs-cli
|
||||||
|
COPY --from=builder /src/bin/frostfs-adm /bin/frostfs-adm
|
||||||
|
|
||||||
CMD ["frostfs-node"]
|
CMD ["frostfs-node"]
|
||||||
|
|
|
@ -114,7 +114,7 @@ func printStorageNodeBalances(cmd *cobra.Command, inv *invoker.Invoker, nmHash u
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("can't parse the list of storage nodes")
|
return errors.New("can't parse the list of storage nodes")
|
||||||
}
|
}
|
||||||
var ni netmap.NodeInfo
|
ni := netmap.NewNodeInfo()
|
||||||
if err := ni.Unmarshal(bs); err != nil {
|
if err := ni.Unmarshal(bs); err != nil {
|
||||||
return fmt.Errorf("can't parse the list of storage nodes: %w", err)
|
return fmt.Errorf("can't parse the list of storage nodes: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
|
||||||
|
@ -118,7 +119,7 @@ type GetContainerRes struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container returns structured of the requested container.
|
// Container returns structured of the requested container.
|
||||||
func (x GetContainerRes) Container() containerSDK.Container {
|
func (x GetContainerRes) Container() *containerSDK.Container {
|
||||||
return x.cliRes.Container()
|
return x.cliRes.Container()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +370,7 @@ func (x *PutObjectPrm) PrepareLocally() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PutObjectPrm) convertToSDKPrm(ctx context.Context) (client.PrmObjectPutInit, error) {
|
func (x *PutObjectPrm) convertToSDKPrm(ctx context.Context) (client.PrmObjectPutInit, error) {
|
||||||
var putPrm client.PrmObjectPutInit
|
putPrm := client.NewPrmObjectPutInit()
|
||||||
if !x.prepareLocally && x.sessionToken != nil {
|
if !x.prepareLocally && x.sessionToken != nil {
|
||||||
putPrm.WithinSession(*x.sessionToken)
|
putPrm.WithinSession(*x.sessionToken)
|
||||||
}
|
}
|
||||||
|
@ -502,7 +503,7 @@ func (x DeleteObjectRes) Tombstone() oid.ID {
|
||||||
//
|
//
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
func DeleteObject(ctx context.Context, prm DeleteObjectPrm) (*DeleteObjectRes, error) {
|
func DeleteObject(ctx context.Context, prm DeleteObjectPrm) (*DeleteObjectRes, error) {
|
||||||
var delPrm client.PrmObjectDelete
|
delPrm := client.NewPrmObjectDelete()
|
||||||
delPrm.FromContainer(prm.objAddr.Container())
|
delPrm.FromContainer(prm.objAddr.Container())
|
||||||
delPrm.ByID(prm.objAddr.Object())
|
delPrm.ByID(prm.objAddr.Object())
|
||||||
|
|
||||||
|
@ -558,7 +559,7 @@ func (x GetObjectRes) Header() *objectSDK.Object {
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
// For raw reading, returns *object.SplitInfoError error if object is virtual.
|
// For raw reading, returns *object.SplitInfoError error if object is virtual.
|
||||||
func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
|
func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
|
||||||
var getPrm client.PrmObjectGet
|
getPrm := client.NewPrmObjectGet()
|
||||||
getPrm.FromContainer(prm.objAddr.Container())
|
getPrm.FromContainer(prm.objAddr.Container())
|
||||||
getPrm.ByID(prm.objAddr.Object())
|
getPrm.ByID(prm.objAddr.Object())
|
||||||
|
|
||||||
|
@ -585,14 +586,14 @@ func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
|
||||||
return nil, fmt.Errorf("init object reading on client: %w", err)
|
return nil, fmt.Errorf("init object reading on client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hdr objectSDK.Object
|
hdr := object.New()
|
||||||
|
|
||||||
if !rdr.ReadHeader(&hdr) {
|
if !rdr.ReadHeader(hdr) {
|
||||||
_, err = rdr.Close()
|
_, err = rdr.Close()
|
||||||
return nil, fmt.Errorf("read object header: %w", err)
|
return nil, fmt.Errorf("read object header: %w", err)
|
||||||
}
|
}
|
||||||
if prm.headerCallback != nil {
|
if prm.headerCallback != nil {
|
||||||
prm.headerCallback(&hdr)
|
prm.headerCallback(hdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = io.Copy(prm.wrt, rdr)
|
_, err = io.Copy(prm.wrt, rdr)
|
||||||
|
@ -601,7 +602,7 @@ func GetObject(ctx context.Context, prm GetObjectPrm) (*GetObjectRes, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return &GetObjectRes{
|
return &GetObjectRes{
|
||||||
hdr: &hdr,
|
hdr: hdr,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +635,7 @@ func (x HeadObjectRes) Header() *objectSDK.Object {
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
// For raw reading, returns *object.SplitInfoError error if object is virtual.
|
// For raw reading, returns *object.SplitInfoError error if object is virtual.
|
||||||
func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error) {
|
func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error) {
|
||||||
var cliPrm client.PrmObjectHead
|
cliPrm := client.NewPrmObjectHead()
|
||||||
cliPrm.FromContainer(prm.objAddr.Container())
|
cliPrm.FromContainer(prm.objAddr.Container())
|
||||||
cliPrm.ByID(prm.objAddr.Object())
|
cliPrm.ByID(prm.objAddr.Object())
|
||||||
|
|
||||||
|
@ -661,14 +662,14 @@ func HeadObject(ctx context.Context, prm HeadObjectPrm) (*HeadObjectRes, error)
|
||||||
return nil, fmt.Errorf("read object header via client: %w", err)
|
return nil, fmt.Errorf("read object header via client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hdr objectSDK.Object
|
hdr := object.New()
|
||||||
|
|
||||||
if !res.ReadHeader(&hdr) {
|
if !res.ReadHeader(hdr) {
|
||||||
return nil, fmt.Errorf("missing header in response")
|
return nil, fmt.Errorf("missing header in response")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &HeadObjectRes{
|
return &HeadObjectRes{
|
||||||
hdr: &hdr,
|
hdr: hdr,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,7 +700,7 @@ func (x SearchObjectsRes) IDList() []oid.ID {
|
||||||
//
|
//
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
func SearchObjects(ctx context.Context, prm SearchObjectsPrm) (*SearchObjectsRes, error) {
|
func SearchObjects(ctx context.Context, prm SearchObjectsPrm) (*SearchObjectsRes, error) {
|
||||||
var cliPrm client.PrmObjectSearch
|
cliPrm := client.NewPrmObjectSearch()
|
||||||
cliPrm.InContainer(prm.cnrID)
|
cliPrm.InContainer(prm.cnrID)
|
||||||
cliPrm.SetFilters(prm.filters)
|
cliPrm.SetFilters(prm.filters)
|
||||||
|
|
||||||
|
@ -789,7 +790,7 @@ func (x HashPayloadRangesRes) HashList() [][]byte {
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
// Returns an error if number of received hashes differs with the number of requested ranges.
|
// Returns an error if number of received hashes differs with the number of requested ranges.
|
||||||
func HashPayloadRanges(ctx context.Context, prm HashPayloadRangesPrm) (*HashPayloadRangesRes, error) {
|
func HashPayloadRanges(ctx context.Context, prm HashPayloadRangesPrm) (*HashPayloadRangesRes, error) {
|
||||||
var cliPrm client.PrmObjectHash
|
cliPrm := client.NewPrmObjectHash()
|
||||||
cliPrm.FromContainer(prm.objAddr.Container())
|
cliPrm.FromContainer(prm.objAddr.Container())
|
||||||
cliPrm.ByID(prm.objAddr.Object())
|
cliPrm.ByID(prm.objAddr.Object())
|
||||||
|
|
||||||
|
@ -857,7 +858,7 @@ type PayloadRangeRes struct{}
|
||||||
// Returns any error which prevented the operation from completing correctly in error return.
|
// Returns any error which prevented the operation from completing correctly in error return.
|
||||||
// For raw reading, returns *object.SplitInfoError error if object is virtual.
|
// For raw reading, returns *object.SplitInfoError error if object is virtual.
|
||||||
func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, error) {
|
func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, error) {
|
||||||
var cliPrm client.PrmObjectRange
|
cliPrm := client.NewPrmObjectRange()
|
||||||
cliPrm.FromContainer(prm.objAddr.Container())
|
cliPrm.FromContainer(prm.objAddr.Container())
|
||||||
cliPrm.ByID(prm.objAddr.Object())
|
cliPrm.ByID(prm.objAddr.Object())
|
||||||
|
|
||||||
|
@ -921,7 +922,7 @@ func SyncContainerSettings(ctx context.Context, prm SyncContainerPrm) (*SyncCont
|
||||||
panic("sync container settings with the network: nil container")
|
panic("sync container settings with the network: nil container")
|
||||||
}
|
}
|
||||||
|
|
||||||
err := client.SyncContainerWithNetwork(ctx, prm.c, prm.cli)
|
err := client.SyncContainerWithNetwork(ctx, *prm.c, prm.cli)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ func ReadBearerToken(cmd *cobra.Command, flagname string) *bearer.Token {
|
||||||
|
|
||||||
PrintVerbose(cmd, "Reading bearer token from file [%s]...", path)
|
PrintVerbose(cmd, "Reading bearer token from file [%s]...", path)
|
||||||
|
|
||||||
var tok bearer.Token
|
tok := bearer.NewToken()
|
||||||
|
|
||||||
err = ReadBinaryOrJSON(cmd, &tok, path)
|
err = ReadBinaryOrJSON(cmd, &tok, path)
|
||||||
commonCmd.ExitOnErr(cmd, "invalid bearer token: %v", err)
|
commonCmd.ExitOnErr(cmd, "invalid bearer token: %v", err)
|
||||||
|
|
|
@ -95,7 +95,7 @@ func createToken(cmd *cobra.Command, _ []string) {
|
||||||
var ownerID user.ID
|
var ownerID user.ID
|
||||||
commonCmd.ExitOnErr(cmd, "can't parse recipient: %w", ownerID.DecodeString(ownerStr))
|
commonCmd.ExitOnErr(cmd, "can't parse recipient: %w", ownerID.DecodeString(ownerStr))
|
||||||
|
|
||||||
var b bearer.Token
|
b := bearer.NewToken()
|
||||||
b.SetExp(exp)
|
b.SetExp(exp)
|
||||||
b.SetNbf(nvb)
|
b.SetNbf(nvb)
|
||||||
b.SetIat(iat)
|
b.SetIat(iat)
|
||||||
|
@ -107,7 +107,7 @@ func createToken(cmd *cobra.Command, _ []string) {
|
||||||
raw, err := os.ReadFile(eaclPath)
|
raw, err := os.ReadFile(eaclPath)
|
||||||
commonCmd.ExitOnErr(cmd, "can't read extended ACL file: %w", err)
|
commonCmd.ExitOnErr(cmd, "can't read extended ACL file: %w", err)
|
||||||
commonCmd.ExitOnErr(cmd, "can't parse extended ACL: %w", json.Unmarshal(raw, table))
|
commonCmd.ExitOnErr(cmd, "can't parse extended ACL: %w", json.Unmarshal(raw, table))
|
||||||
b.SetEACLTable(*table)
|
b.SetEACLTable(table)
|
||||||
}
|
}
|
||||||
|
|
||||||
var data []byte
|
var data []byte
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
containerApi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
containerApi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
|
||||||
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||||
|
@ -68,10 +68,10 @@ It will be stored in sidechain when inner ring will accepts it.`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var cnr container.Container
|
cnr := container.NewContainer()
|
||||||
cnr.Init()
|
cnr.Init()
|
||||||
|
|
||||||
err = parseAttributes(&cnr, containerAttributes)
|
err = parseAttributes(cnr, containerAttributes)
|
||||||
commonCmd.ExitOnErr(cmd, "", err)
|
commonCmd.ExitOnErr(cmd, "", err)
|
||||||
|
|
||||||
var basicACL acl.Basic
|
var basicACL acl.Basic
|
||||||
|
@ -189,7 +189,7 @@ func parseContainerPolicy(cmd *cobra.Command, policyString string) (*netmap.Plac
|
||||||
return nil, errors.New("can't parse placement policy")
|
return nil, errors.New("can't parse placement policy")
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseAttributes(dst *container.Container, attributes []string) error {
|
func parseAttributes(dst container.Container, attributes []string) error {
|
||||||
for i := range attributes {
|
for i := range attributes {
|
||||||
k, v, found := strings.Cut(attributes[i], attributeDelimiter)
|
k, v, found := strings.Cut(attributes[i], attributeDelimiter)
|
||||||
if !found {
|
if !found {
|
||||||
|
|
|
@ -76,7 +76,7 @@ func (x *stringWriter) WriteString(s string) (n int, err error) {
|
||||||
|
|
||||||
func prettyPrintContainer(cmd *cobra.Command, cnr container.Container, jsonEncoding bool) {
|
func prettyPrintContainer(cmd *cobra.Command, cnr container.Container, jsonEncoding bool) {
|
||||||
if jsonEncoding {
|
if jsonEncoding {
|
||||||
common.PrettyPrintJSON(cmd, cnr, "container")
|
common.PrettyPrintJSON(cmd, &cnr, "container")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ func prettyPrintBasicACL(cmd *cobra.Command, basicACL acl.Basic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getContainer(cmd *cobra.Command) (container.Container, *ecdsa.PrivateKey) {
|
func getContainer(cmd *cobra.Command) (container.Container, *ecdsa.PrivateKey) {
|
||||||
var cnr container.Container
|
cnr := container.NewContainer()
|
||||||
var pk *ecdsa.PrivateKey
|
var pk *ecdsa.PrivateKey
|
||||||
if containerPathFrom != "" {
|
if containerPathFrom != "" {
|
||||||
data, err := os.ReadFile(containerPathFrom)
|
data, err := os.ReadFile(containerPathFrom)
|
||||||
|
@ -154,7 +154,7 @@ func getContainer(cmd *cobra.Command) (container.Container, *ecdsa.PrivateKey) {
|
||||||
res, err := internalclient.GetContainer(cmd.Context(), prm)
|
res, err := internalclient.GetContainer(cmd.Context(), prm)
|
||||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||||
|
|
||||||
cnr = res.Container()
|
cnr = *res.Container()
|
||||||
}
|
}
|
||||||
return cnr, pk
|
return cnr, pk
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package container
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
containerapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
|
||||||
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
||||||
|
@ -70,16 +70,15 @@ var listContainersCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
cnr := res.Container()
|
cnr := res.Container()
|
||||||
if cnrName := containerSDK.Name(cnr); flagVarListName != "" && cnrName != flagVarListName {
|
if cnrName := containerSDK.Name(*cnr); flagVarListName != "" && cnrName != flagVarListName {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cmd.Println(cnrID.String())
|
cmd.Println(cnrID.String())
|
||||||
|
|
||||||
if flagVarListPrintAttr {
|
if flagVarListPrintAttr {
|
||||||
cnr.IterateAttributes(func(key, val string) {
|
cnr.IterateAttributes(func(key, val string) {
|
||||||
if !strings.HasPrefix(key, container.SysAttributePrefix) && !strings.HasPrefix(key, container.SysAttributePrefixNeoFS) {
|
if !strings.HasPrefix(key, containerapi.SysAttributePrefix) && !strings.HasPrefix(key, containerapi.SysAttributePrefixNeoFS) {
|
||||||
// FIXME(@cthulhu-rider): https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/issues/97
|
// FIXME(@cthulhu-rider): neofs-sdk-go#314 use dedicated method to skip system attributes
|
||||||
// Use dedicated method to skip system attributes.
|
|
||||||
cmd.Printf(" %s: %s\n", key, val)
|
cmd.Printf(" %s: %s\n", key, val)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -69,11 +69,11 @@ var listContainerObjectsCmd = &cobra.Command{
|
||||||
if err == nil {
|
if err == nil {
|
||||||
attrs := resHead.Header().Attributes()
|
attrs := resHead.Header().Attributes()
|
||||||
for i := range attrs {
|
for i := range attrs {
|
||||||
attrKey := attrs[i].Key()
|
attrKey := attrs[i].GetKey()
|
||||||
if !strings.HasPrefix(attrKey, v2object.SysAttributePrefix) && !strings.HasPrefix(attrKey, v2object.SysAttributePrefixNeoFS) {
|
if !strings.HasPrefix(attrKey, v2object.SysAttributePrefix) && !strings.HasPrefix(attrKey, v2object.SysAttributePrefixNeoFS) {
|
||||||
// FIXME(@cthulhu-rider): https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/issues/97
|
// FIXME(@cthulhu-rider): https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/issues/97
|
||||||
// Use dedicated method to skip system attributes.
|
// Use dedicated method to skip system attributes.
|
||||||
cmd.Printf(" %s: %s\n", attrKey, attrs[i].Value())
|
cmd.Printf(" %s: %s\n", attrKey, attrs[i].GetValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -50,7 +50,7 @@ Container ID in EACL table will be substituted with ID from the CLI.`,
|
||||||
|
|
||||||
var setEACLPrm internalclient.SetEACLPrm
|
var setEACLPrm internalclient.SetEACLPrm
|
||||||
setEACLPrm.SetClient(cli)
|
setEACLPrm.SetClient(cli)
|
||||||
setEACLPrm.SetTable(*eaclTable)
|
setEACLPrm.SetTable(eaclTable)
|
||||||
|
|
||||||
if tok != nil {
|
if tok != nil {
|
||||||
setEACLPrm.WithinSession(*tok)
|
setEACLPrm.WithinSession(*tok)
|
||||||
|
|
|
@ -47,7 +47,7 @@ func getSession(cmd *cobra.Command) *session.Container {
|
||||||
|
|
||||||
common.PrintVerbose(cmd, "Reading container session from the file [%s]...", path)
|
common.PrintVerbose(cmd, "Reading container session from the file [%s]...", path)
|
||||||
|
|
||||||
var res session.Container
|
res := session.NewContainer()
|
||||||
|
|
||||||
err := common.ReadBinaryOrJSON(cmd, &res, path)
|
err := common.ReadBinaryOrJSON(cmd, &res, path)
|
||||||
commonCmd.ExitOnErr(cmd, "read container session: %v", err)
|
commonCmd.ExitOnErr(cmd, "read container session: %v", err)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||||
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
||||||
|
@ -40,14 +40,14 @@ func verifyResponse(cmd *cobra.Command,
|
||||||
commonCmd.ExitOnErr(cmd, "", errors.New("missing response signature"))
|
commonCmd.ExitOnErr(cmd, "", errors.New("missing response signature"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(@cthulhu-rider): #468 use Signature message from FrostFS API to avoid conversion
|
// TODO(@cthulhu-rider): #1387 use Signature message from NeoFS API to avoid conversion
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsapi.Signature
|
||||||
sigV2.SetScheme(refs.ECDSA_SHA512)
|
sigV2.SetScheme(refsapi.SignatureScheme_ECDSA_SHA512)
|
||||||
sigV2.SetKey(sigControl.GetKey())
|
sigV2.SetKey(sigControl.GetKey())
|
||||||
sigV2.SetSign(sigControl.GetSign())
|
sigV2.SetSign(sigControl.GetSign())
|
||||||
|
|
||||||
var sig frostfscrypto.Signature
|
sig := frostfscrypto.NewSignature()
|
||||||
commonCmd.ExitOnErr(cmd, "can't read signature: %w", sig.ReadFromV2(sigV2))
|
commonCmd.ExitOnErr(cmd, "can't read signature: %w", sig.ReadFromV2(&sigV2))
|
||||||
|
|
||||||
if !sig.Verify(body.StableMarshal(nil)) {
|
if !sig.Verify(body.StableMarshal(nil)) {
|
||||||
commonCmd.ExitOnErr(cmd, "", errors.New("invalid response signature"))
|
commonCmd.ExitOnErr(cmd, "", errors.New("invalid response signature"))
|
||||||
|
|
|
@ -41,7 +41,7 @@ func initNodeInfoCmd() {
|
||||||
func prettyPrintNodeInfo(cmd *cobra.Command, i netmap.NodeInfo) {
|
func prettyPrintNodeInfo(cmd *cobra.Command, i netmap.NodeInfo) {
|
||||||
isJSON, _ := cmd.Flags().GetBool(nodeInfoJSONFlag)
|
isJSON, _ := cmd.Flags().GetBool(nodeInfoJSONFlag)
|
||||||
if isJSON {
|
if isJSON {
|
||||||
common.PrettyPrintJSON(cmd, i, "node info")
|
common.PrettyPrintJSON(cmd, &i, "node info")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ func prettyPrintNodeInfo(cmd *cobra.Command, i netmap.NodeInfo) {
|
||||||
|
|
||||||
cmd.Println("state:", stateWord)
|
cmd.Println("state:", stateWord)
|
||||||
|
|
||||||
netmap.IterateNetworkEndpoints(i, func(s string) {
|
netmap.IterateNetworkEndpoints(&i, func(s string) {
|
||||||
cmd.Println("address:", s)
|
cmd.Println("address:", s)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ func getObjectHash(cmd *cobra.Command, _ []string) {
|
||||||
res, err := internalclient.HeadObject(cmd.Context(), headPrm)
|
res, err := internalclient.HeadObject(cmd.Context(), headPrm)
|
||||||
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||||
|
|
||||||
var cs checksum.Checksum
|
cs := checksum.NewChecksum()
|
||||||
var csSet bool
|
var csSet bool
|
||||||
|
|
||||||
if tz {
|
if tz {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||||
|
@ -150,21 +150,21 @@ func printHeader(cmd *cobra.Command, obj *objectSDK.Object) error {
|
||||||
|
|
||||||
cmd.Println("Attributes:")
|
cmd.Println("Attributes:")
|
||||||
for _, attr := range obj.Attributes() {
|
for _, attr := range obj.Attributes() {
|
||||||
if attr.Key() == objectSDK.AttributeTimestamp {
|
if attr.GetKey() == objectSDK.AttributeTimestamp {
|
||||||
cmd.Printf(" %s=%s (%s)\n",
|
cmd.Printf(" %s=%s (%s)\n",
|
||||||
attr.Key(),
|
attr.GetKey(),
|
||||||
attr.Value(),
|
attr.GetValue(),
|
||||||
common.PrettyPrintUnixTime(attr.Value()))
|
common.PrettyPrintUnixTime(attr.GetValue()))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cmd.Printf(" %s=%s\n", attr.Key(), attr.Value())
|
cmd.Printf(" %s=%s\n", attr.GetKey(), attr.GetValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
if signature := obj.Signature(); signature != nil {
|
if signature := obj.Signature(); signature != nil {
|
||||||
cmd.Print("ID signature:\n")
|
cmd.Print("ID signature:\n")
|
||||||
|
|
||||||
// TODO(@carpawell): #468 implement and use another approach to avoid conversion
|
// TODO(@carpawell): #1387 implement and use another approach to avoid conversion
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsapi.Signature
|
||||||
signature.WriteToV2(&sigV2)
|
signature.WriteToV2(&sigV2)
|
||||||
|
|
||||||
cmd.Printf(" public key: %s\n", hex.EncodeToString(sigV2.GetKey()))
|
cmd.Printf(" public key: %s\n", hex.EncodeToString(sigV2.GetKey()))
|
||||||
|
|
|
@ -65,7 +65,7 @@ var objectLockCmd = &cobra.Command{
|
||||||
var idOwner user.ID
|
var idOwner user.ID
|
||||||
user.IDFromKey(&idOwner, key.PublicKey)
|
user.IDFromKey(&idOwner, key.PublicKey)
|
||||||
|
|
||||||
var lock objectSDK.Lock
|
lock := objectSDK.NewLock()
|
||||||
lock.WriteMembers(lockList)
|
lock.WriteMembers(lockList)
|
||||||
|
|
||||||
exp, _ := cmd.Flags().GetUint64(commonflags.ExpireAt)
|
exp, _ := cmd.Flags().GetUint64(commonflags.ExpireAt)
|
||||||
|
@ -88,7 +88,7 @@ var objectLockCmd = &cobra.Command{
|
||||||
|
|
||||||
common.PrintVerbose(cmd, "Lock object will expire after %d epoch", exp)
|
common.PrintVerbose(cmd, "Lock object will expire after %d epoch", exp)
|
||||||
|
|
||||||
var expirationAttr objectSDK.Attribute
|
expirationAttr := *objectSDK.NewAttribute()
|
||||||
expirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
expirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
expirationAttr.SetValue(strconv.FormatUint(exp, 10))
|
expirationAttr.SetValue(strconv.FormatUint(exp, 10))
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
||||||
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
"github.com/cheggaaa/pb"
|
"github.com/cheggaaa/pb"
|
||||||
|
@ -196,7 +197,7 @@ func getAllObjectAttributes(cmd *cobra.Command) []objectSDK.Attribute {
|
||||||
expAttrValue := strconv.FormatUint(expiresOn, 10)
|
expAttrValue := strconv.FormatUint(expiresOn, 10)
|
||||||
|
|
||||||
for i := range attrs {
|
for i := range attrs {
|
||||||
if attrs[i].Key() == objectV2.SysAttributeExpEpoch {
|
if attrs[i].GetKey() == objectV2.SysAttributeExpEpoch {
|
||||||
attrs[i].SetValue(expAttrValue)
|
attrs[i].SetValue(expAttrValue)
|
||||||
expAttrFound = true
|
expAttrFound = true
|
||||||
break
|
break
|
||||||
|
@ -205,7 +206,7 @@ func getAllObjectAttributes(cmd *cobra.Command) []objectSDK.Attribute {
|
||||||
|
|
||||||
if !expAttrFound {
|
if !expAttrFound {
|
||||||
index := len(attrs)
|
index := len(attrs)
|
||||||
attrs = append(attrs, objectSDK.Attribute{})
|
attrs = append(attrs, *objectSDK.NewAttribute())
|
||||||
attrs[index].SetKey(objectV2.SysAttributeExpEpoch)
|
attrs[index].SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
attrs[index].SetValue(expAttrValue)
|
attrs[index].SetValue(expAttrValue)
|
||||||
}
|
}
|
||||||
|
@ -227,6 +228,7 @@ func parseObjectAttrs(cmd *cobra.Command) ([]objectSDK.Attribute, error) {
|
||||||
if !found {
|
if !found {
|
||||||
return nil, fmt.Errorf("invalid attribute format: %s", rawAttrs[i])
|
return nil, fmt.Errorf("invalid attribute format: %s", rawAttrs[i])
|
||||||
}
|
}
|
||||||
|
attrs[i] = *object.NewAttribute()
|
||||||
attrs[i].SetKey(k)
|
attrs[i].SetKey(k)
|
||||||
attrs[i].SetValue(v)
|
attrs[i].SetValue(v)
|
||||||
}
|
}
|
||||||
|
@ -235,7 +237,7 @@ func parseObjectAttrs(cmd *cobra.Command) ([]objectSDK.Attribute, error) {
|
||||||
if !disableFilename {
|
if !disableFilename {
|
||||||
filename := filepath.Base(cmd.Flag(fileFlag).Value.String())
|
filename := filepath.Base(cmd.Flag(fileFlag).Value.String())
|
||||||
index := len(attrs)
|
index := len(attrs)
|
||||||
attrs = append(attrs, objectSDK.Attribute{})
|
attrs = append(attrs, *objectSDK.NewAttribute())
|
||||||
attrs[index].SetKey(objectSDK.AttributeFileName)
|
attrs[index].SetKey(objectSDK.AttributeFileName)
|
||||||
attrs[index].SetValue(filename)
|
attrs[index].SetValue(filename)
|
||||||
}
|
}
|
||||||
|
@ -243,7 +245,7 @@ func parseObjectAttrs(cmd *cobra.Command) ([]objectSDK.Attribute, error) {
|
||||||
disableTime, _ := cmd.Flags().GetBool("disable-timestamp")
|
disableTime, _ := cmd.Flags().GetBool("disable-timestamp")
|
||||||
if !disableTime {
|
if !disableTime {
|
||||||
index := len(attrs)
|
index := len(attrs)
|
||||||
attrs = append(attrs, objectSDK.Attribute{})
|
attrs = append(attrs, *objectSDK.NewAttribute())
|
||||||
attrs[index].SetKey(objectSDK.AttributeTimestamp)
|
attrs[index].SetKey(objectSDK.AttributeTimestamp)
|
||||||
attrs[index].SetValue(strconv.FormatInt(time.Now().Unix(), 10))
|
attrs[index].SetValue(strconv.FormatInt(time.Now().Unix(), 10))
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) {
|
||||||
|
|
||||||
data := res.Object()
|
data := res.Object()
|
||||||
|
|
||||||
var o objectSDK.Object
|
o := *objectSDK.New()
|
||||||
common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w",
|
common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w",
|
||||||
o.Unmarshal(data)),
|
o.Unmarshal(data)),
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,7 +21,7 @@ func PrintObjectHeader(cmd *cobra.Command, h objectSDK.Object) {
|
||||||
cmd.Println("PayloadSize:", h.PayloadSize())
|
cmd.Println("PayloadSize:", h.PayloadSize())
|
||||||
cmd.Println("Attributes:")
|
cmd.Println("Attributes:")
|
||||||
for _, attr := range h.Attributes() {
|
for _, attr := range h.Attributes() {
|
||||||
cmd.Printf(" %s: %s\n", attr.Key(), attr.Value())
|
cmd.Printf(" %s: %s\n", attr.GetKey(), attr.GetValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ func inspectFunc(cmd *cobra.Command, _ []string) {
|
||||||
data, err := writecache.Get(db, []byte(vAddress))
|
data, err := writecache.Get(db, []byte(vAddress))
|
||||||
common.ExitOnErr(cmd, common.Errf("could not fetch object: %w", err))
|
common.ExitOnErr(cmd, common.Errf("could not fetch object: %w", err))
|
||||||
|
|
||||||
var o objectSDK.Object
|
o := *objectSDK.New()
|
||||||
common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w", o.Unmarshal(data)))
|
common.ExitOnErr(cmd, common.Errf("could not unmarshal object: %w", o.Unmarshal(data)))
|
||||||
|
|
||||||
common.PrintObjectHeader(cmd, o)
|
common.PrintObjectHeader(cmd, o)
|
||||||
|
|
|
@ -208,7 +208,7 @@ func newCachedContainerStorage(v container.Source, ttl time.Duration) ttlContain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s ttlContainerStorage) handleRemoval(cnr cid.ID) {
|
func (s ttlContainerStorage) handleRemoval(cnr cid.ID) {
|
||||||
s.set(cnr, nil, apistatus.ContainerNotFound{})
|
s.set(cnr, nil, apistatus.NewContainerNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get returns container value from the cache. If value is missing in the cache
|
// Get returns container value from the cache. If value is missing in the cache
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
netmapV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
|
netmapV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
||||||
apiclientconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/apiclient"
|
apiclientconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/apiclient"
|
||||||
contractsconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/contracts"
|
contractsconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/contracts"
|
||||||
|
@ -423,7 +423,7 @@ type cfg struct {
|
||||||
// latest epoch. Returns an error if value has not been cached yet.
|
// latest epoch. Returns an error if value has not been cached yet.
|
||||||
//
|
//
|
||||||
// Provides interface for NetmapService server.
|
// Provides interface for NetmapService server.
|
||||||
func (c *cfg) ReadCurrentNetMap(msg *netmapV2.NetMap) error {
|
func (c *cfg) ReadCurrentNetMap(msg *netmapV2.Netmap) error {
|
||||||
val := c.netMap.Load()
|
val := c.netMap.Load()
|
||||||
if val == nil {
|
if val == nil {
|
||||||
return errors.New("missing local network map")
|
return errors.New("missing local network map")
|
||||||
|
@ -563,6 +563,8 @@ func initCfg(appCfg *config.Config) *cfg {
|
||||||
}
|
}
|
||||||
c.cfgContainer = initContainer(appCfg)
|
c.cfgContainer = initContainer(appCfg)
|
||||||
|
|
||||||
|
c.cfgNodeInfo = initCfgNodeInfo()
|
||||||
|
|
||||||
c.cfgNetmap = initNetmap(appCfg, netState, relayOnly)
|
c.cfgNetmap = initNetmap(appCfg, netState, relayOnly)
|
||||||
|
|
||||||
c.cfgGRPC = initCfgGRPC()
|
c.cfgGRPC = initCfgGRPC()
|
||||||
|
@ -654,6 +656,12 @@ func initContainer(appCfg *config.Config) cfgContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initCfgNodeInfo() cfgNodeInfo {
|
||||||
|
return cfgNodeInfo{
|
||||||
|
localInfo: netmap.NewNodeInfo(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func initCfgGRPC() cfgGRPC {
|
func initCfgGRPC() cfgGRPC {
|
||||||
maxChunkSize := uint64(maxMsgSize) * 3 / 4 // 25% to meta, 75% to payload
|
maxChunkSize := uint64(maxMsgSize) * 3 / 4 // 25% to meta, 75% to payload
|
||||||
maxAddrAmount := uint64(maxChunkSize) / addressSize // each address is about 72 bytes
|
maxAddrAmount := uint64(maxChunkSize) / addressSize // each address is about 72 bytes
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
containerV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
|
|
||||||
containerGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
|
containerGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
||||||
|
@ -470,7 +469,7 @@ func (d *localStorageLoad) Iterate(f loadcontroller.UsedSpaceFilter, h loadcontr
|
||||||
zap.Stringer("cid", idList[i]),
|
zap.Stringer("cid", idList[i]),
|
||||||
)
|
)
|
||||||
|
|
||||||
var a containerSDK.SizeEstimation
|
a := *containerSDK.NewSizeEstimation()
|
||||||
a.SetContainer(idList[i])
|
a.SetContainer(idList[i])
|
||||||
a.SetValue(sz)
|
a.SetValue(sz)
|
||||||
|
|
||||||
|
@ -534,10 +533,10 @@ func (c *usedSpaceService) ExternalAddresses() []string {
|
||||||
return c.cfg.ExternalAddresses()
|
return c.cfg.ExternalAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *containerV2.AnnounceUsedSpaceRequest) (*containerV2.AnnounceUsedSpaceResponse, error) {
|
func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *containerGRPC.AnnounceUsedSpaceRequest) (*containerGRPC.AnnounceUsedSpaceResponse, error) {
|
||||||
var passedRoute []loadcontroller.ServerInfo
|
var passedRoute []loadcontroller.ServerInfo
|
||||||
|
|
||||||
for hdr := req.GetVerificationHeader(); hdr != nil; hdr = hdr.GetOrigin() {
|
for hdr := req.GetVerifyHeader(); hdr != nil; hdr = hdr.GetOrigin() {
|
||||||
passedRoute = append(passedRoute, &containerOnlyKeyRemoteServerInfo{
|
passedRoute = append(passedRoute, &containerOnlyKeyRemoteServerInfo{
|
||||||
key: hdr.GetBodySignature().GetKey(),
|
key: hdr.GetBodySignature().GetKey(),
|
||||||
})
|
})
|
||||||
|
@ -554,7 +553,7 @@ func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *container
|
||||||
return nil, fmt.Errorf("could not initialize container's used space writer: %w", err)
|
return nil, fmt.Errorf("could not initialize container's used space writer: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var est containerSDK.SizeEstimation
|
est := *containerSDK.NewSizeEstimation()
|
||||||
|
|
||||||
for _, aV2 := range req.GetBody().GetAnnouncements() {
|
for _, aV2 := range req.GetBody().GetAnnouncements() {
|
||||||
err = est.ReadFromV2(aV2)
|
err = est.ReadFromV2(aV2)
|
||||||
|
@ -567,9 +566,9 @@ func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *container
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
respBody := new(containerV2.AnnounceUsedSpaceResponseBody)
|
respBody := new(containerGRPC.AnnounceUsedSpaceResponse_Body)
|
||||||
|
|
||||||
resp := new(containerV2.AnnounceUsedSpaceResponse)
|
resp := new(containerGRPC.AnnounceUsedSpaceResponse)
|
||||||
resp.SetBody(respBody)
|
resp.SetBody(respBody)
|
||||||
|
|
||||||
c.cfg.respSvc.SetMeta(resp)
|
c.cfg.respSvc.SetMeta(resp)
|
||||||
|
|
BIN
cmd/frostfs-node/frostfs-node
Executable file
BIN
cmd/frostfs-node/frostfs-node
Executable file
Binary file not shown.
|
@ -445,7 +445,7 @@ func (n *netInfo) Dump(ver version.Version) (*netmapSDK.NetworkInfo, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var ni netmapSDK.NetworkInfo
|
ni := netmapSDK.NewNetworkInfo()
|
||||||
ni.SetCurrentEpoch(n.netState.CurrentEpoch())
|
ni.SetCurrentEpoch(n.netState.CurrentEpoch())
|
||||||
ni.SetMagicNumber(magic)
|
ni.SetMagicNumber(magic)
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ func (n *netInfo) Dump(ver version.Version) (*netmapSDK.NetworkInfo, error) {
|
||||||
return nil, fmt.Errorf("read network configuration using netmap contract client: %w", err)
|
return nil, fmt.Errorf("read network configuration using netmap contract client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if mjr := ver.Major(); mjr > 2 || mjr == 2 && ver.Minor() > 9 {
|
if mjr := ver.GetMajor(); mjr > 2 || mjr == 2 && ver.GetMinor() > 9 {
|
||||||
msPerBlock, err := n.msPerBlockRdr()
|
msPerBlock, err := n.msPerBlockRdr()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("ms per block: %w", err)
|
return nil, fmt.Errorf("ms per block: %w", err)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
|
||||||
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc"
|
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc"
|
||||||
metricsconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/metrics"
|
metricsconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/metrics"
|
||||||
policerconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/policer"
|
policerconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/policer"
|
||||||
|
@ -70,31 +69,31 @@ func (s *objectSvc) Put() (objectService.PutObjectStream, error) {
|
||||||
return s.put.Put()
|
return s.put.Put()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) PutSingle(ctx context.Context, req *object.PutSingleRequest) (*object.PutSingleResponse, error) {
|
func (s *objectSvc) PutSingle(ctx context.Context, req *objectGRPC.PutSingleRequest) (*objectGRPC.PutSingleResponse, error) {
|
||||||
return s.put.PutSingle(ctx, req)
|
return s.put.PutSingle(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) Head(ctx context.Context, req *object.HeadRequest) (*object.HeadResponse, error) {
|
func (s *objectSvc) Head(ctx context.Context, req *objectGRPC.HeadRequest) (*objectGRPC.HeadResponse, error) {
|
||||||
return s.get.Head(ctx, req)
|
return s.get.Head(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) Search(req *object.SearchRequest, stream objectService.SearchStream) error {
|
func (s *objectSvc) Search(req *objectGRPC.SearchRequest, stream objectService.SearchStream) error {
|
||||||
return s.search.Search(req, stream)
|
return s.search.Search(req, stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) Get(req *object.GetRequest, stream objectService.GetObjectStream) error {
|
func (s *objectSvc) Get(req *objectGRPC.GetRequest, stream objectService.GetObjectStream) error {
|
||||||
return s.get.Get(req, stream)
|
return s.get.Get(req, stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
func (s *objectSvc) Delete(ctx context.Context, req *objectGRPC.DeleteRequest) (*objectGRPC.DeleteResponse, error) {
|
||||||
return s.delete.Delete(ctx, req)
|
return s.delete.Delete(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) GetRange(req *object.GetRangeRequest, stream objectService.GetObjectRangeStream) error {
|
func (s *objectSvc) GetRange(req *objectGRPC.GetRangeRequest, stream objectService.GetObjectRangeStream) error {
|
||||||
return s.get.GetRange(req, stream)
|
return s.get.GetRange(req, stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *objectSvc) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
func (s *objectSvc) GetRangeHash(ctx context.Context, req *objectGRPC.GetRangeHashRequest) (*objectGRPC.GetRangeHashResponse, error) {
|
||||||
return s.get.GetRangeHash(ctx, req)
|
return s.get.GetRangeHash(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
|
||||||
sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
|
sessionGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
|
||||||
nodeconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/node"
|
nodeconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/node"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||||
|
@ -19,7 +18,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type sessionStorage interface {
|
type sessionStorage interface {
|
||||||
Create(ctx context.Context, body *session.CreateRequestBody) (*session.CreateResponseBody, error)
|
Create(ctx context.Context, body *sessionGRPC.CreateRequest_Body) (*sessionGRPC.CreateResponse_Body, error)
|
||||||
Get(ownerID user.ID, tokenID []byte) *storage.PrivateToken
|
Get(ownerID user.ID, tokenID []byte) *storage.PrivateToken
|
||||||
RemoveOld(epoch uint64)
|
RemoveOld(epoch uint64)
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||||
var (
|
var (
|
||||||
code int
|
code int
|
||||||
|
|
||||||
internalErr = new(sdkstatus.ServerInternal)
|
internalErr = sdkstatus.NewServerInternal()
|
||||||
accessErr = new(sdkstatus.ObjectAccessDenied)
|
accessErr = sdkstatus.NewObjectAccessDenied()
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
|
|
@ -26,7 +26,7 @@ func PrettyPrintNodeInfo(cmd *cobra.Command, node netmap.NodeInfo,
|
||||||
|
|
||||||
cmd.Printf("%sNode %d: %s %s ", indent, index+1, hex.EncodeToString(node.PublicKey()), strState)
|
cmd.Printf("%sNode %d: %s %s ", indent, index+1, hex.EncodeToString(node.PublicKey()), strState)
|
||||||
|
|
||||||
netmap.IterateNetworkEndpoints(node, func(endpoint string) {
|
netmap.IterateNetworkEndpoints(&node, func(endpoint string) {
|
||||||
cmd.Printf("%s ", endpoint)
|
cmd.Printf("%s ", endpoint)
|
||||||
})
|
})
|
||||||
cmd.Println()
|
cmd.Println()
|
||||||
|
|
5
go.mod
5
go.mod
|
@ -2,6 +2,11 @@ module git.frostfs.info/TrueCloudLab/frostfs-node
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
replace (
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe => git.frostfs.info/aarifullin/frostfs-api-go/v2 v2.15.1-0.20230710090848-bc16a32c24c3
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230706140617-98cab7ed6166 => git.frostfs.info/aarifullin/frostfs-sdk-go v0.0.0-20230712160837-6281a25556ae
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe
|
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a
|
||||||
|
|
129
go.mod.docker
Normal file
129
go.mod.docker
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
module git.frostfs.info/TrueCloudLab/frostfs-node
|
||||||
|
|
||||||
|
go 1.19
|
||||||
|
|
||||||
|
replace (
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230602142716-68021b910acb => ./frostfs-api-go
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230628121302-5d62cef27e6c => ./frostfs-sdk-go
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230602142716-68021b910acb
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230628121302-5d62cef27e6c
|
||||||
|
git.frostfs.info/TrueCloudLab/hrw v1.2.1
|
||||||
|
git.frostfs.info/TrueCloudLab/tzhash v1.8.0
|
||||||
|
github.com/cheggaaa/pb v1.0.29
|
||||||
|
github.com/chzyer/readline v1.5.1
|
||||||
|
github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568
|
||||||
|
github.com/google/uuid v1.3.0
|
||||||
|
github.com/hashicorp/golang-lru/v2 v2.0.4
|
||||||
|
github.com/klauspost/compress v1.16.6
|
||||||
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
|
github.com/mr-tron/base58 v1.2.0
|
||||||
|
github.com/multiformats/go-multiaddr v0.9.0
|
||||||
|
github.com/nats-io/nats.go v1.27.1
|
||||||
|
github.com/nspcc-dev/neo-go v0.101.2-0.20230601131642-a0117042e8fc
|
||||||
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
|
github.com/panjf2000/ants/v2 v2.7.5
|
||||||
|
github.com/paulmach/orb v0.9.2
|
||||||
|
github.com/prometheus/client_golang v1.16.0
|
||||||
|
github.com/spf13/cast v1.5.1
|
||||||
|
github.com/spf13/cobra v1.7.0
|
||||||
|
github.com/spf13/pflag v1.0.5
|
||||||
|
github.com/spf13/viper v1.16.0
|
||||||
|
github.com/stretchr/testify v1.8.4
|
||||||
|
go.etcd.io/bbolt v1.3.7
|
||||||
|
go.opentelemetry.io/otel v1.16.0
|
||||||
|
go.opentelemetry.io/otel/trace v1.16.0
|
||||||
|
go.uber.org/zap v1.24.0
|
||||||
|
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
|
||||||
|
golang.org/x/sync v0.3.0
|
||||||
|
golang.org/x/term v0.9.0
|
||||||
|
google.golang.org/grpc v1.56.1
|
||||||
|
google.golang.org/protobuf v1.31.0
|
||||||
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 // indirect
|
||||||
|
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 // indirect
|
||||||
|
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
|
||||||
|
github.com/benbjohnson/clock v1.3.5 // indirect
|
||||||
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
|
github.com/bits-and-blooms/bitset v1.8.0 // indirect
|
||||||
|
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||||
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||||
|
github.com/consensys/bavard v0.1.13 // indirect
|
||||||
|
github.com/consensys/gnark-crypto v0.11.0 // indirect
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
||||||
|
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||||
|
github.com/go-logr/logr v1.2.4 // indirect
|
||||||
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
|
github.com/gorilla/websocket v1.5.0 // indirect
|
||||||
|
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 // indirect
|
||||||
|
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.5 // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
|
||||||
|
github.com/hashicorp/golang-lru v0.6.0 // indirect
|
||||||
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
|
github.com/holiman/uint256 v1.2.2 // indirect
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
|
github.com/ipfs/go-cid v0.4.1 // indirect
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||||
|
github.com/magiconair/properties v1.8.7 // indirect
|
||||||
|
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||||
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||||
|
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
|
github.com/mmcloughlin/addchain v0.4.0 // indirect
|
||||||
|
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||||
|
github.com/multiformats/go-base36 v0.2.0 // indirect
|
||||||
|
github.com/multiformats/go-multibase v0.2.0 // indirect
|
||||||
|
github.com/multiformats/go-multihash v0.2.3 // indirect
|
||||||
|
github.com/multiformats/go-varint v0.0.7 // indirect
|
||||||
|
github.com/nats-io/nats-server/v2 v2.7.4 // indirect
|
||||||
|
github.com/nats-io/nkeys v0.4.4 // indirect
|
||||||
|
github.com/nats-io/nuid v1.0.1 // indirect
|
||||||
|
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect
|
||||||
|
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230615193820-9185820289ce // indirect
|
||||||
|
github.com/nspcc-dev/rfc6979 v0.2.0 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/prometheus/client_model v0.4.0 // indirect
|
||||||
|
github.com/prometheus/common v0.44.0 // indirect
|
||||||
|
github.com/prometheus/procfs v0.11.0 // indirect
|
||||||
|
github.com/rivo/uniseg v0.4.4 // indirect
|
||||||
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||||
|
github.com/spf13/afero v1.9.5 // indirect
|
||||||
|
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||||
|
github.com/subosito/gotenv v1.4.2 // indirect
|
||||||
|
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 // indirect
|
||||||
|
github.com/twmb/murmur3 v1.1.8 // indirect
|
||||||
|
github.com/urfave/cli v1.22.14 // indirect
|
||||||
|
go.mongodb.org/mongo-driver v1.12.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/metric v1.16.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/sdk v1.16.0 // indirect
|
||||||
|
go.opentelemetry.io/proto/otlp v0.20.0 // indirect
|
||||||
|
go.uber.org/atomic v1.11.0 // indirect
|
||||||
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
|
golang.org/x/crypto v0.10.0 // indirect
|
||||||
|
golang.org/x/net v0.11.0 // indirect
|
||||||
|
golang.org/x/sys v0.9.0 // indirect
|
||||||
|
golang.org/x/text v0.10.0 // indirect
|
||||||
|
google.golang.org/genproto v0.0.0-20230628200519-e449d1ea0e82 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20230628200519-e449d1ea0e82 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230628200519-e449d1ea0e82 // indirect
|
||||||
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
|
lukechampine.com/blake3 v1.2.1 // indirect
|
||||||
|
rsc.io/tmplfunc v0.0.3 // indirect
|
||||||
|
)
|
1008
go.mod.sum
Normal file
1008
go.mod.sum
Normal file
File diff suppressed because it is too large
Load diff
8
go.sum
8
go.sum
|
@ -36,22 +36,22 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
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.15.1-0.20230704092742-285516a94ebe h1:SB102RiEg+4h9qcwyG97zHBtwduMRbedbtkwRDVSps8=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.15.1-0.20230704092742-285516a94ebe/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a h1:EeaOunifY30ATPzOo1F32vUDW299UXDHYukZrIVxBZ0=
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a h1:EeaOunifY30ATPzOo1F32vUDW299UXDHYukZrIVxBZ0=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o=
|
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230627134746-36f3d39c406a/go.mod h1:nkR5gaGeez3Zv2SE7aceP0YwxG2FzIB5cGKpQO2vV2o=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0 h1:FxqFDhQYYgpe41qsIHVOcdzSVCB8JNSfPG7Uk4r2oSk=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
|
git.frostfs.info/TrueCloudLab/frostfs-crypto v0.6.0/go.mod h1:RUIKZATQLJ+TaYQa60X2fTDwfuhMfm8Ar60bQ5fr+vU=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 h1:aGQ6QaAnTerQ5Dq5b2/f9DUQtSqPkZZ/bkMx/HKuLCo=
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6 h1:aGQ6QaAnTerQ5Dq5b2/f9DUQtSqPkZZ/bkMx/HKuLCo=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6/go.mod h1:W8Nn08/l6aQ7UlIbpF7FsQou7TVpcRD1ZT1KG4TrFhE=
|
git.frostfs.info/TrueCloudLab/frostfs-observability v0.0.0-20230531082742-c97d21411eb6/go.mod h1:W8Nn08/l6aQ7UlIbpF7FsQou7TVpcRD1ZT1KG4TrFhE=
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230706140617-98cab7ed6166 h1:HSwD/CDbrUp45gQmfn9KYag8zN0GD+HA0l2+U+c3Ayo=
|
|
||||||
git.frostfs.info/TrueCloudLab/frostfs-sdk-go v0.0.0-20230706140617-98cab7ed6166/go.mod h1:r5Fir/4jCVXzdfOyCUbikSDB99nVqnHNq7mzVcidnlA=
|
|
||||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc=
|
git.frostfs.info/TrueCloudLab/hrw v1.2.1 h1:ccBRK21rFvY5R1WotI6LNoPlizk7qSvdfD8lNIRudVc=
|
||||||
git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM=
|
git.frostfs.info/TrueCloudLab/hrw v1.2.1/go.mod h1:C1Ygde2n843yTZEQ0FP69jYiuaYV0kriLvP4zm8JuvM=
|
||||||
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=
|
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0 h1:M2KR3iBj7WpY3hP10IevfIB9MURr4O9mwVfJ+SjT3HA=
|
||||||
git.frostfs.info/TrueCloudLab/rfc6979 v0.4.0/go.mod h1:okpbKfVYf/BpejtfFTfhZqFP+sZ8rsHrP8Rr/jYPNRc=
|
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 h1:UFMnUIk0Zh17m8rjGHJMqku2hCgaXDqjqZzS4gsb4UA=
|
||||||
git.frostfs.info/TrueCloudLab/tzhash v1.8.0/go.mod h1:dhY+oy274hV8wGvGL4MwwMpdL3GYvaX1a8GQZQHvlF8=
|
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.20230710090848-bc16a32c24c3 h1:QuPPpzIaS6GGKgwDnhMLKjgS9iHO6e/3sQtFIUX0LMc=
|
||||||
|
git.frostfs.info/aarifullin/frostfs-api-go/v2 v2.15.1-0.20230710090848-bc16a32c24c3/go.mod h1:pKJJRLOChW4zDQsAt1e8k/snWKljJtpkiPfxV53ngjI=
|
||||||
|
git.frostfs.info/aarifullin/frostfs-sdk-go v0.0.0-20230712160837-6281a25556ae h1:L1rcvPZbhGs13kxFDVyNQFPC3DhKrEX56JKIAyrLhVg=
|
||||||
|
git.frostfs.info/aarifullin/frostfs-sdk-go v0.0.0-20230712160837-6281a25556ae/go.mod h1:w70mg6mJpw1Cku1uPVpA7Kk08ZQsbHGW2hYpTDJD6tQ=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package container
|
package container
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
|
||||||
)
|
)
|
||||||
|
@ -14,7 +14,7 @@ type RemovalWitness struct {
|
||||||
ContainerID cid.ID
|
ContainerID cid.ID
|
||||||
|
|
||||||
// Signature the signature of the container identifier.
|
// Signature the signature of the container identifier.
|
||||||
Signature *refs.Signature
|
Signature *refsGRPC.Signature
|
||||||
|
|
||||||
// SessionToken the token of the session within
|
// SessionToken the token of the session within
|
||||||
// which the container was removed.
|
// which the container was removed.
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
package netmap
|
package netmap
|
||||||
|
|
||||||
import "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
import (
|
||||||
|
netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||||
|
)
|
||||||
|
|
||||||
// Node is a named type of netmap.NodeInfo which provides interface needed
|
// Node is a named type of netmap.NodeInfo which provides interface needed
|
||||||
// in the current repository. Node is expected to be used everywhere instead
|
// in the current repository. Node is expected to be used everywhere instead
|
||||||
// of direct usage of netmap.NodeInfo, so it represents a type mediator.
|
// of direct usage of netmap.NodeInfo, so it represents a type mediator.
|
||||||
type Node netmap.NodeInfo
|
type Node netmapGRPC.NodeInfo
|
||||||
|
|
||||||
// PublicKey returns public key bound to the storage node.
|
// PublicKey returns public key bound to the storage node.
|
||||||
//
|
//
|
||||||
// Return value MUST NOT be mutated, make a copy first.
|
// Return value MUST NOT be mutated, make a copy first.
|
||||||
func (x Node) PublicKey() []byte {
|
func (x Node) PublicKey() []byte {
|
||||||
return (netmap.NodeInfo)(x).PublicKey()
|
return (netmapGRPC.NodeInfo)(x).PublicKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
// IterateAddresses iterates over all announced network addresses
|
// IterateAddresses iterates over all announced network addresses
|
||||||
// and passes them into f. Handler MUST NOT be nil.
|
// and passes them into f. Handler MUST NOT be nil.
|
||||||
func (x Node) IterateAddresses(f func(string) bool) {
|
func (x Node) IterateAddresses(f func(string) bool) {
|
||||||
(netmap.NodeInfo)(x).IterateNetworkEndpoints(f)
|
(netmapGRPC.NodeInfo)(x).IterateNetworkEndpoints(f)
|
||||||
for _, addr := range (netmap.NodeInfo)(x).ExternalAddresses() {
|
for _, addr := range (netmapGRPC.NodeInfo)(x).ExternalAddresses() {
|
||||||
if f(addr) {
|
if f(addr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -27,15 +29,15 @@ func (x Node) IterateAddresses(f func(string) bool) {
|
||||||
|
|
||||||
// NumberOfAddresses returns number of announced network addresses.
|
// NumberOfAddresses returns number of announced network addresses.
|
||||||
func (x Node) NumberOfAddresses() int {
|
func (x Node) NumberOfAddresses() int {
|
||||||
return (netmap.NodeInfo)(x).NumberOfNetworkEndpoints()
|
return (netmapGRPC.NodeInfo)(x).NumberOfNetworkEndpoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExternalAddresses returns external addresses of a node.
|
// ExternalAddresses returns external addresses of a node.
|
||||||
func (x Node) ExternalAddresses() []string {
|
func (x Node) ExternalAddresses() []string {
|
||||||
return (netmap.NodeInfo)(x).ExternalAddresses()
|
return (netmapGRPC.NodeInfo)(x).ExternalAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nodes is a named type of []netmap.NodeInfo which provides interface needed
|
// Nodes is a named type of []netmap.NodeInfo which provides interface needed
|
||||||
// in the current repository. Nodes is expected to be used everywhere instead
|
// in the current repository. Nodes is expected to be used everywhere instead
|
||||||
// of direct usage of []netmap.NodeInfo, so it represents a type mediator.
|
// of direct usage of []netmap.NodeInfo, so it represents a type mediator.
|
||||||
type Nodes []netmap.NodeInfo
|
type Nodes []netmapGRPC.NodeInfo
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
objectV2 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
||||||
|
@ -139,7 +139,7 @@ func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
|
||||||
return errors.New("missing signature")
|
return errors.New("missing signature")
|
||||||
}
|
}
|
||||||
|
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsGRPC.Signature
|
||||||
sig.WriteToV2(&sigV2)
|
sig.WriteToV2(&sigV2)
|
||||||
|
|
||||||
binKey := sigV2.GetKey()
|
binKey := sigV2.GetKey()
|
||||||
|
@ -240,7 +240,7 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *objectSDK.Object, meta *Con
|
||||||
return fmt.Errorf("lock object expiration: %d; current: %d", lockExp, currEpoch)
|
return fmt.Errorf("lock object expiration: %d; current: %d", lockExp, currEpoch)
|
||||||
}
|
}
|
||||||
|
|
||||||
var lock objectSDK.Lock
|
lock := objectSDK.NewLock()
|
||||||
|
|
||||||
if err = lock.Unmarshal(o.Payload()); err != nil {
|
if err = lock.Unmarshal(o.Payload()); err != nil {
|
||||||
return fmt.Errorf("decode lock payload: %w", err)
|
return fmt.Errorf("decode lock payload: %w", err)
|
||||||
|
@ -323,11 +323,11 @@ func (v *FormatValidator) checkExpiration(ctx context.Context, obj *objectSDK.Ob
|
||||||
|
|
||||||
func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) {
|
func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) {
|
||||||
for _, a := range obj.Attributes() {
|
for _, a := range obj.Attributes() {
|
||||||
if a.Key() != objectV2.SysAttributeExpEpoch && a.Key() != objectV2.SysAttributeExpEpochNeoFS {
|
if a.GetKey() != objectV2.SysAttributeExpEpoch && a.GetKey() != objectV2.SysAttributeExpEpochNeoFS {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
return strconv.ParseUint(a.Value(), 10, 64)
|
return strconv.ParseUint(a.GetValue(), 10, 64)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0, errNoExpirationEpoch
|
return 0, errNoExpirationEpoch
|
||||||
|
@ -344,13 +344,13 @@ func (v *FormatValidator) checkAttributes(obj *objectSDK.Object) error {
|
||||||
mUnique := make(map[string]struct{}, len(as))
|
mUnique := make(map[string]struct{}, len(as))
|
||||||
|
|
||||||
for _, a := range as {
|
for _, a := range as {
|
||||||
key := a.Key()
|
key := a.GetKey()
|
||||||
|
|
||||||
if _, was := mUnique[key]; was {
|
if _, was := mUnique[key]; was {
|
||||||
return errDuplAttr
|
return errDuplAttr
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.Value() == "" {
|
if a.GetValue() == "" {
|
||||||
return errEmptyAttrVal
|
return errEmptyAttrVal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
_, err = v.ValidateContent(obj)
|
_, err = v.ValidateContent(obj)
|
||||||
require.Error(t, err) // no expiration epoch in tombstone
|
require.Error(t, err) // no expiration epoch in tombstone
|
||||||
|
|
||||||
var expirationAttribute objectSDK.Attribute
|
expirationAttribute := *objectSDK.NewAttribute()
|
||||||
expirationAttribute.SetKey(objectV2.SysAttributeExpEpoch)
|
expirationAttribute.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
expirationAttribute.SetValue(strconv.Itoa(10))
|
expirationAttribute.SetValue(strconv.Itoa(10))
|
||||||
|
|
||||||
|
@ -170,11 +170,11 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
fn := func(val string) *objectSDK.Object {
|
fn := func(val string) *objectSDK.Object {
|
||||||
obj := blankValidObject(&ownerKey.PrivateKey)
|
obj := blankValidObject(&ownerKey.PrivateKey)
|
||||||
|
|
||||||
var a objectSDK.Attribute
|
a := objectSDK.NewAttribute()
|
||||||
a.SetKey(objectV2.SysAttributeExpEpoch)
|
a.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
a.SetValue(val)
|
a.SetValue(val)
|
||||||
|
|
||||||
obj.SetAttributes(a)
|
obj.SetAttributes(*a)
|
||||||
|
|
||||||
require.NoError(t, objectSDK.SetIDWithSignature(ownerKey.PrivateKey, obj))
|
require.NoError(t, objectSDK.SetIDWithSignature(ownerKey.PrivateKey, obj))
|
||||||
|
|
||||||
|
@ -204,7 +204,6 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
addr.SetContainer(cID)
|
addr.SetContainer(cID)
|
||||||
addr.SetObject(oID)
|
addr.SetObject(oID)
|
||||||
ls.m[addr] = true
|
ls.m[addr] = true
|
||||||
|
|
||||||
err := v.Validate(context.Background(), obj, false)
|
err := v.Validate(context.Background(), obj, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
@ -221,11 +220,11 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
t.Run("duplication", func(t *testing.T) {
|
t.Run("duplication", func(t *testing.T) {
|
||||||
obj := blankValidObject(&ownerKey.PrivateKey)
|
obj := blankValidObject(&ownerKey.PrivateKey)
|
||||||
|
|
||||||
var a1 objectSDK.Attribute
|
a1 := *objectSDK.NewAttribute()
|
||||||
a1.SetKey("key1")
|
a1.SetKey("key1")
|
||||||
a1.SetValue("val1")
|
a1.SetValue("val1")
|
||||||
|
|
||||||
var a2 objectSDK.Attribute
|
a2 := *objectSDK.NewAttribute()
|
||||||
a2.SetKey("key2")
|
a2.SetKey("key2")
|
||||||
a2.SetValue("val2")
|
a2.SetValue("val2")
|
||||||
|
|
||||||
|
@ -234,7 +233,7 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
err := v.checkAttributes(obj)
|
err := v.checkAttributes(obj)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
a2.SetKey(a1.Key())
|
a2.SetKey(a1.GetKey())
|
||||||
obj.SetAttributes(a1, a2)
|
obj.SetAttributes(a1, a2)
|
||||||
|
|
||||||
err = v.checkAttributes(obj)
|
err = v.checkAttributes(obj)
|
||||||
|
@ -244,10 +243,10 @@ func TestFormatValidator_Validate(t *testing.T) {
|
||||||
t.Run("empty value", func(t *testing.T) {
|
t.Run("empty value", func(t *testing.T) {
|
||||||
obj := blankValidObject(&ownerKey.PrivateKey)
|
obj := blankValidObject(&ownerKey.PrivateKey)
|
||||||
|
|
||||||
var a objectSDK.Attribute
|
a := objectSDK.NewAttribute()
|
||||||
a.SetKey("key")
|
a.SetKey("key")
|
||||||
|
|
||||||
obj.SetAttributes(a)
|
obj.SetAttributes(*a)
|
||||||
|
|
||||||
err := v.checkAttributes(obj)
|
err := v.checkAttributes(obj)
|
||||||
require.Equal(t, errEmptyAttrVal, err)
|
require.Equal(t, errEmptyAttrVal, err)
|
||||||
|
|
|
@ -11,7 +11,7 @@ func IsValid(v version.Version) bool {
|
||||||
startMinor = 7
|
startMinor = 7
|
||||||
)
|
)
|
||||||
|
|
||||||
mjr := v.Major()
|
mjr := v.GetMajor()
|
||||||
|
|
||||||
return mjr > startMajor || mjr == startMajor && v.Minor() >= startMinor
|
return mjr > startMajor || mjr == startMajor && v.GetMinor() >= startMinor
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
func TestIsValid(t *testing.T) {
|
func TestIsValid(t *testing.T) {
|
||||||
require.True(t, version.IsValid(versionSDK.Current()))
|
require.True(t, version.IsValid(versionSDK.Current()))
|
||||||
|
|
||||||
var v versionSDK.Version
|
v := versionSDK.NewVersion()
|
||||||
|
|
||||||
for _, item := range []struct {
|
for _, item := range []struct {
|
||||||
mjr, mnr uint32
|
mjr, mnr uint32
|
||||||
|
|
|
@ -27,12 +27,12 @@ func TestProcessorEmitsGasToNetmapAndAlphabet(t *testing.T) {
|
||||||
|
|
||||||
morphClient := &testMorphClient{}
|
morphClient := &testMorphClient{}
|
||||||
|
|
||||||
var node1 netmap.NodeInfo
|
node1 := netmap.NewNodeInfo()
|
||||||
key1, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
key1, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
||||||
require.NoError(t, err, "failed to parse key1")
|
require.NoError(t, err, "failed to parse key1")
|
||||||
node1.SetPublicKey(key1.Bytes())
|
node1.SetPublicKey(key1.Bytes())
|
||||||
|
|
||||||
var node2 netmap.NodeInfo
|
node2 := netmap.NewNodeInfo()
|
||||||
key2, err := keys.NewPublicKeyFromString("02ac920cd7df0b61b289072e6b946e2da4e1a31b9ab1c621bb475e30fa4ab102c3")
|
key2, err := keys.NewPublicKeyFromString("02ac920cd7df0b61b289072e6b946e2da4e1a31b9ab1c621bb475e30fa4ab102c3")
|
||||||
require.NoError(t, err, "failed to parse key2")
|
require.NoError(t, err, "failed to parse key2")
|
||||||
node2.SetPublicKey(key2.Bytes())
|
node2.SetPublicKey(key2.Bytes())
|
||||||
|
@ -104,12 +104,12 @@ func TestProcessorEmitsGasToNetmapIfNoParsedWallets(t *testing.T) {
|
||||||
|
|
||||||
morphClient := &testMorphClient{}
|
morphClient := &testMorphClient{}
|
||||||
|
|
||||||
var node1 netmap.NodeInfo
|
node1 := netmap.NewNodeInfo()
|
||||||
key1, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
key1, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
||||||
require.NoError(t, err, "failed to parse key1")
|
require.NoError(t, err, "failed to parse key1")
|
||||||
node1.SetPublicKey(key1.Bytes())
|
node1.SetPublicKey(key1.Bytes())
|
||||||
|
|
||||||
var node2 netmap.NodeInfo
|
node2 := netmap.NewNodeInfo()
|
||||||
key2, err := keys.NewPublicKeyFromString("02ac920cd7df0b61b289072e6b946e2da4e1a31b9ab1c621bb475e30fa4ab102c3")
|
key2, err := keys.NewPublicKeyFromString("02ac920cd7df0b61b289072e6b946e2da4e1a31b9ab1c621bb475e30fa4ab102c3")
|
||||||
require.NoError(t, err, "failed to parse key2")
|
require.NoError(t, err, "failed to parse key2")
|
||||||
node2.SetPublicKey(key2.Bytes())
|
node2.SetPublicKey(key2.Bytes())
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (cp *Processor) checkTokenLifetime(token session.Container) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cp *Processor) verifyByTokenSession(v signatureVerificationData, key *frostfsecdsa.PublicKeyRFC6979, keyProvided bool) error {
|
func (cp *Processor) verifyByTokenSession(v signatureVerificationData, key *frostfsecdsa.PublicKeyRFC6979, keyProvided bool) error {
|
||||||
var tok session.Container
|
tok := session.NewContainer()
|
||||||
|
|
||||||
err := tok.Unmarshal(v.binTokenSession)
|
err := tok.Unmarshal(v.binTokenSession)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -55,12 +55,12 @@ func TestPutEvent(t *testing.T) {
|
||||||
var pp netmap.PlacementPolicy
|
var pp netmap.PlacementPolicy
|
||||||
pp.AddReplicas(netmap.ReplicaDescriptor{})
|
pp.AddReplicas(netmap.ReplicaDescriptor{})
|
||||||
|
|
||||||
var cnr containerSDK.Container
|
cnr := containerSDK.NewContainer()
|
||||||
cnr.Init()
|
cnr.Init()
|
||||||
cnr.SetOwner(usr)
|
cnr.SetOwner(usr)
|
||||||
cnr.SetPlacementPolicy(pp)
|
cnr.SetPlacementPolicy(pp)
|
||||||
cnr.SetBasicACL(acl.Private)
|
cnr.SetBasicACL(acl.Private)
|
||||||
containerSDK.DisableHomomorphicHashing(&cnr)
|
containerSDK.DisableHomomorphicHashing(cnr)
|
||||||
|
|
||||||
nr := &payload.P2PNotaryRequest{
|
nr := &payload.P2PNotaryRequest{
|
||||||
MainTransaction: &transaction.Transaction{},
|
MainTransaction: &transaction.Transaction{},
|
||||||
|
@ -119,12 +119,12 @@ func TestDeleteEvent(t *testing.T) {
|
||||||
var pp netmap.PlacementPolicy
|
var pp netmap.PlacementPolicy
|
||||||
pp.AddReplicas(netmap.ReplicaDescriptor{})
|
pp.AddReplicas(netmap.ReplicaDescriptor{})
|
||||||
|
|
||||||
var cnr containerSDK.Container
|
cnr := containerSDK.NewContainer()
|
||||||
cnr.Init()
|
cnr.Init()
|
||||||
cnr.SetOwner(usr)
|
cnr.SetOwner(usr)
|
||||||
cnr.SetPlacementPolicy(pp)
|
cnr.SetPlacementPolicy(pp)
|
||||||
cnr.SetBasicACL(acl.Private)
|
cnr.SetBasicACL(acl.Private)
|
||||||
containerSDK.DisableHomomorphicHashing(&cnr)
|
containerSDK.DisableHomomorphicHashing(cnr)
|
||||||
|
|
||||||
var cid cid.ID
|
var cid cid.ID
|
||||||
containerSDK.CalculateID(&cid, cnr)
|
containerSDK.CalculateID(&cid, cnr)
|
||||||
|
@ -141,7 +141,7 @@ func TestDeleteEvent(t *testing.T) {
|
||||||
NotaryRequestValue: nr,
|
NotaryRequestValue: nr,
|
||||||
}
|
}
|
||||||
|
|
||||||
var signature frostfscrypto.Signature
|
signature := frostfscrypto.NewSignature()
|
||||||
signer := frostfsecdsa.Signer(p.PrivateKey)
|
signer := frostfsecdsa.Signer(p.PrivateKey)
|
||||||
require.NoError(t, signature.Calculate(signer, ev.ContainerID()), "failed to calculate signature")
|
require.NoError(t, signature.Calculate(signer, ev.ContainerID()), "failed to calculate signature")
|
||||||
cc.get[hex.EncodeToString(ev.ContainerID())] = &containercore.Container{
|
cc.get[hex.EncodeToString(ev.ContainerID())] = &containercore.Container{
|
||||||
|
@ -193,19 +193,19 @@ func TestSetEACLEvent(t *testing.T) {
|
||||||
var pp netmap.PlacementPolicy
|
var pp netmap.PlacementPolicy
|
||||||
pp.AddReplicas(netmap.ReplicaDescriptor{})
|
pp.AddReplicas(netmap.ReplicaDescriptor{})
|
||||||
|
|
||||||
var cnr containerSDK.Container
|
cnr := containerSDK.NewContainer()
|
||||||
cnr.Init()
|
cnr.Init()
|
||||||
cnr.SetOwner(usr)
|
cnr.SetOwner(usr)
|
||||||
cnr.SetPlacementPolicy(pp)
|
cnr.SetPlacementPolicy(pp)
|
||||||
cnr.SetBasicACL(acl.PrivateExtended)
|
cnr.SetBasicACL(acl.PrivateExtended)
|
||||||
containerSDK.DisableHomomorphicHashing(&cnr)
|
containerSDK.DisableHomomorphicHashing(cnr)
|
||||||
|
|
||||||
var cid cid.ID
|
var cid cid.ID
|
||||||
containerSDK.CalculateID(&cid, cnr)
|
containerSDK.CalculateID(&cid, cnr)
|
||||||
cidBytes := make([]byte, 32)
|
cidBytes := make([]byte, 32)
|
||||||
cid.Encode(cidBytes)
|
cid.Encode(cidBytes)
|
||||||
|
|
||||||
var signature frostfscrypto.Signature
|
signature := frostfscrypto.NewSignature()
|
||||||
signer := frostfsecdsa.Signer(p.PrivateKey)
|
signer := frostfsecdsa.Signer(p.PrivateKey)
|
||||||
require.NoError(t, signature.Calculate(signer, cidBytes), "failed to calculate signature")
|
require.NoError(t, signature.Calculate(signer, cidBytes), "failed to calculate signature")
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ func (c *testContainerClient) Get(cid []byte) (*containercore.Container, error)
|
||||||
if cont, found := c.get[key]; found {
|
if cont, found := c.get[key]; found {
|
||||||
return cont, nil
|
return cont, nil
|
||||||
}
|
}
|
||||||
return nil, apistatus.ContainerNotFound{}
|
return nil, apistatus.NewContainerNotFound()
|
||||||
}
|
}
|
||||||
|
|
||||||
type testIDClient struct {
|
type testIDClient struct {
|
||||||
|
|
|
@ -62,7 +62,7 @@ func (cp *Processor) processContainerPut(put putEvent) bool {
|
||||||
|
|
||||||
func (cp *Processor) checkPutContainer(ctx *putContainerContext) error {
|
func (cp *Processor) checkPutContainer(ctx *putContainerContext) error {
|
||||||
binCnr := ctx.e.Container()
|
binCnr := ctx.e.Container()
|
||||||
var cnr containerSDK.Container
|
cnr := containerSDK.NewContainer()
|
||||||
|
|
||||||
err := cnr.Unmarshal(binCnr)
|
err := cnr.Unmarshal(binCnr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -128,6 +128,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newNodeInfo(key *keys.PublicKey) (n netmap.NodeInfo) {
|
func newNodeInfo(key *keys.PublicKey) (n netmap.NodeInfo) {
|
||||||
|
n = netmap.NewNodeInfo()
|
||||||
n.SetPublicKey(key.Bytes())
|
n.SetPublicKey(key.Bytes())
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
|
v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
|
||||||
netmapContract "git.frostfs.info/TrueCloudLab/frostfs-contract/netmap"
|
netmapContract "git.frostfs.info/TrueCloudLab/frostfs-contract/netmap"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/governance"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/governance"
|
||||||
timerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/timers"
|
timerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/timers"
|
||||||
|
@ -50,12 +50,12 @@ func TestNewEpochTick(t *testing.T) {
|
||||||
|
|
||||||
func TestNewEpoch(t *testing.T) {
|
func TestNewEpoch(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
var node1 netmap.NodeInfo
|
node1 := netmap.NewNodeInfo()
|
||||||
key1, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
key1, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
||||||
require.NoError(t, err, "failed to parse key1")
|
require.NoError(t, err, "failed to parse key1")
|
||||||
node1.SetPublicKey(key1.Bytes())
|
node1.SetPublicKey(key1.Bytes())
|
||||||
|
|
||||||
var node2 netmap.NodeInfo
|
node2 := netmap.NewNodeInfo()
|
||||||
key2, err := keys.NewPublicKeyFromString("02ac920cd7df0b61b289072e6b946e2da4e1a31b9ab1c621bb475e30fa4ab102c3")
|
key2, err := keys.NewPublicKeyFromString("02ac920cd7df0b61b289072e6b946e2da4e1a31b9ab1c621bb475e30fa4ab102c3")
|
||||||
require.NoError(t, err, "failed to parse key2")
|
require.NoError(t, err, "failed to parse key2")
|
||||||
node2.SetPublicKey(key2.Bytes())
|
node2.SetPublicKey(key2.Bytes())
|
||||||
|
@ -127,7 +127,7 @@ func TestAddPeer(t *testing.T) {
|
||||||
|
|
||||||
require.NoError(t, err, "failed to create processor")
|
require.NoError(t, err, "failed to create processor")
|
||||||
|
|
||||||
var node netmap.NodeInfo
|
node := netmap.NewNodeInfo()
|
||||||
key, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
key, err := keys.NewPublicKeyFromString("038c862959e56b43e20f79187c4fe9e0bc7c8c66c1603e6cf0ec7f87ab6b08dc35")
|
||||||
require.NoError(t, err, "failed to parse key")
|
require.NoError(t, err, "failed to parse key")
|
||||||
node.SetPublicKey(key.Bytes())
|
node.SetPublicKey(key.Bytes())
|
||||||
|
@ -245,7 +245,7 @@ func TestCleanupTick(t *testing.T) {
|
||||||
nonce: uint32(ev.epoch),
|
nonce: uint32(ev.epoch),
|
||||||
vub: nil,
|
vub: nil,
|
||||||
method: "updateStateIR",
|
method: "updateStateIR",
|
||||||
args: []any{int64(v2netmap.Offline), keyExp.Bytes()},
|
args: []any{int64(v2netmap.NodeInfo_OFFLINE), keyExp.Bytes()},
|
||||||
},
|
},
|
||||||
}, nc.notaryInvokes, "invalid notary invokes")
|
}, nc.notaryInvokes, "invalid notary invokes")
|
||||||
require.True(t, proc.netmapSnapshot.lastAccess[key1Str].removeFlag, "invalid expired removed flag")
|
require.True(t, proc.netmapSnapshot.lastAccess[key1Str].removeFlag, "invalid expired removed flag")
|
||||||
|
|
|
@ -43,7 +43,7 @@ func addLocodeAttr(n *netmap.NodeInfo, lc locodestd.LOCODE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func nodeInfoWithSomeAttrs() *netmap.NodeInfo {
|
func nodeInfoWithSomeAttrs() *netmap.NodeInfo {
|
||||||
var n netmap.NodeInfo
|
n := netmap.NewNodeInfo()
|
||||||
|
|
||||||
n.SetAttribute("key1", "val1")
|
n.SetAttribute("key1", "val1")
|
||||||
n.SetAttribute("key2", "val2")
|
n.SetAttribute("key2", "val2")
|
||||||
|
|
|
@ -66,7 +66,7 @@ func TestValidator_VerifyAndUpdate(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
var node netmap.NodeInfo
|
node := netmap.NewNodeInfo()
|
||||||
|
|
||||||
// prepare node
|
// prepare node
|
||||||
testCase.preparer(&node)
|
testCase.preparer(&node)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package netmap
|
package netmap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
|
v2netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -36,7 +36,7 @@ func (np *Processor) processNetmapCleanupTick(ev netmapCleanupTick) bool {
|
||||||
uint32(ev.epoch),
|
uint32(ev.epoch),
|
||||||
nil,
|
nil,
|
||||||
methodUpdateStateNotary,
|
methodUpdateStateNotary,
|
||||||
int64(v2netmap.Offline), key.Bytes(),
|
int64(v2netmap.NodeInfo_OFFLINE), key.Bytes(),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
np.log.Error(logs.NetmapCantInvokeNetmapUpdateState, zap.Error(err))
|
np.log.Error(logs.NetmapCantInvokeNetmapUpdateState, zap.Error(err))
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshal node info
|
// unmarshal node info
|
||||||
var nodeInfo netmap.NodeInfo
|
nodeInfo := netmap.NewNodeInfo()
|
||||||
if err := nodeInfo.Unmarshal(ev.Node()); err != nil {
|
if err := nodeInfo.Unmarshal(ev.Node()); err != nil {
|
||||||
// it will be nice to have tx id at event structure to log it
|
// it will be nice to have tx id at event structure to log it
|
||||||
np.log.Warn(logs.NetmapCantParseNetworkMapCandidate)
|
np.log.Warn(logs.NetmapCantParseNetworkMapCandidate)
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (b *Blobovnicza) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, err
|
||||||
})
|
})
|
||||||
|
|
||||||
if err == nil && !found {
|
if err == nil && !found {
|
||||||
var errNotFound apistatus.ObjectNotFound
|
errNotFound := apistatus.NewObjectNotFound()
|
||||||
|
|
||||||
return DeleteRes{}, errNotFound
|
return DeleteRes{}, errNotFound
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ func (b *Blobovnicza) Get(ctx context.Context, prm GetPrm) (GetRes, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if data == nil {
|
if data == nil {
|
||||||
var errNotFound apistatus.ObjectNotFound
|
errNotFound := apistatus.NewObjectNotFound()
|
||||||
|
|
||||||
return GetRes{}, errNotFound
|
return GetRes{}, errNotFound
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (b *Blobovniczas) Delete(ctx context.Context, prm common.DeletePrm) (res co
|
||||||
|
|
||||||
if err == nil && !objectFound {
|
if err == nil && !objectFound {
|
||||||
// not found in any blobovnicza
|
// not found in any blobovnicza
|
||||||
return common.DeleteRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.DeleteRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
success = err == nil
|
success = err == nil
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ func (b *Blobovniczas) deleteObjectFromLevel(ctx context.Context, prm blobovnicz
|
||||||
// (Blobovniczas "after" the active one are empty anyway,
|
// (Blobovniczas "after" the active one are empty anyway,
|
||||||
// and it's pointless to open them).
|
// and it's pointless to open them).
|
||||||
if u64FromHexString(filepath.Base(blzPath)) > active.ind {
|
if u64FromHexString(filepath.Base(blzPath)) > active.ind {
|
||||||
return common.DeleteRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.DeleteRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
// open blobovnicza (cached inside)
|
// open blobovnicza (cached inside)
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (b *Blobovniczas) Get(ctx context.Context, prm common.GetPrm) (res common.G
|
||||||
|
|
||||||
if err == nil && res.Object == nil {
|
if err == nil && res.Object == nil {
|
||||||
// not found in any blobovnicza
|
// not found in any blobovnicza
|
||||||
return res, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return res, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true
|
success = true
|
||||||
|
@ -141,7 +141,7 @@ func (b *Blobovniczas) getObjectFromLevel(ctx context.Context, prm blobovnicza.G
|
||||||
// (Blobovniczas "after" the active one are empty anyway,
|
// (Blobovniczas "after" the active one are empty anyway,
|
||||||
// and it's pointless to open them).
|
// and it's pointless to open them).
|
||||||
if u64FromHexString(filepath.Base(blzPath)) > active.ind {
|
if u64FromHexString(filepath.Base(blzPath)) > active.ind {
|
||||||
return common.GetRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
// open blobovnicza (cached inside)
|
// open blobovnicza (cached inside)
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (b *Blobovniczas) GetRange(ctx context.Context, prm common.GetRangePrm) (re
|
||||||
|
|
||||||
if err == nil && !objectFound {
|
if err == nil && !objectFound {
|
||||||
// not found in any blobovnicza
|
// not found in any blobovnicza
|
||||||
return common.GetRangeRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRangeRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -159,7 +159,7 @@ func (b *Blobovniczas) getRangeFromLevel(ctx context.Context, prm common.GetRang
|
||||||
// (Blobovniczas "after" the active one are empty anyway,
|
// (Blobovniczas "after" the active one are empty anyway,
|
||||||
// and it's pointless to open them).
|
// and it's pointless to open them).
|
||||||
if u64FromHexString(filepath.Base(blzPath)) > active.ind {
|
if u64FromHexString(filepath.Base(blzPath)) > active.ind {
|
||||||
return common.GetRangeRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRangeRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
// open blobovnicza (cached inside)
|
// open blobovnicza (cached inside)
|
||||||
|
@ -202,7 +202,7 @@ func (b *Blobovniczas) getObjectRange(ctx context.Context, blz *blobovnicza.Blob
|
||||||
payload := obj.Payload()
|
payload := obj.Payload()
|
||||||
|
|
||||||
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
||||||
return common.GetRangeRes{}, logicerr.Wrap(apistatus.ObjectOutOfRange{})
|
return common.GetRangeRes{}, logicerr.Wrap(apistatus.NewObjectOutOfRange())
|
||||||
}
|
}
|
||||||
|
|
||||||
return common.GetRangeRes{
|
return common.GetRangeRes{
|
||||||
|
|
|
@ -66,11 +66,11 @@ func TestCompression(t *testing.T) {
|
||||||
testGet := func(t *testing.T, b *BlobStor, i int) {
|
testGet := func(t *testing.T, b *BlobStor, i int) {
|
||||||
res1, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(smallObj[i])})
|
res1, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(smallObj[i])})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, smallObj[i], res1.Object)
|
require.True(t, smallObj[i].Equal(res1.Object))
|
||||||
|
|
||||||
res2, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(bigObj[i])})
|
res2, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(bigObj[i])})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, bigObj[i], res2.Object)
|
require.True(t, bigObj[i].Equal(res2.Object))
|
||||||
}
|
}
|
||||||
|
|
||||||
testPut := func(t *testing.T, b *BlobStor, i int) {
|
testPut := func(t *testing.T, b *BlobStor, i int) {
|
||||||
|
@ -134,7 +134,7 @@ func TestBlobstor_needsCompression(t *testing.T) {
|
||||||
newObjectWithCt := func(contentType string) *objectSDK.Object {
|
newObjectWithCt := func(contentType string) *objectSDK.Object {
|
||||||
obj := testObject(smallSizeLimit + 1)
|
obj := testObject(smallSizeLimit + 1)
|
||||||
if contentType != "" {
|
if contentType != "" {
|
||||||
var a objectSDK.Attribute
|
a := *objectSDK.NewAttribute()
|
||||||
a.SetKey(objectSDK.AttributeContentType)
|
a.SetKey(objectSDK.AttributeContentType)
|
||||||
a.SetValue(contentType)
|
a.SetValue(contentType)
|
||||||
obj.SetAttributes(a)
|
obj.SetAttributes(a)
|
||||||
|
@ -194,7 +194,7 @@ func TestConcurrentPut(t *testing.T) {
|
||||||
testGet := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
|
testGet := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
|
||||||
res, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(obj)})
|
res, err := b.Get(context.Background(), common.GetPrm{Address: object.AddressOf(obj)})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, obj, res.Object)
|
require.True(t, obj.Equal(res.Object))
|
||||||
}
|
}
|
||||||
|
|
||||||
testPut := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
|
testPut := func(t *testing.T, b *BlobStor, obj *objectSDK.Object) {
|
||||||
|
|
|
@ -50,16 +50,16 @@ func (c *Config) NeedsCompression(obj *objectSDK.Object) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, attr := range obj.Attributes() {
|
for _, attr := range obj.Attributes() {
|
||||||
if attr.Key() == objectSDK.AttributeContentType {
|
if attr.GetKey() == objectSDK.AttributeContentType {
|
||||||
for _, value := range c.UncompressableContentTypes {
|
for _, value := range c.UncompressableContentTypes {
|
||||||
match := false
|
match := false
|
||||||
switch {
|
switch {
|
||||||
case len(value) > 0 && value[len(value)-1] == '*':
|
case len(value) > 0 && value[len(value)-1] == '*':
|
||||||
match = strings.HasPrefix(attr.Value(), value[:len(value)-1])
|
match = strings.HasPrefix(attr.GetValue(), value[:len(value)-1])
|
||||||
case len(value) > 0 && value[0] == '*':
|
case len(value) > 0 && value[0] == '*':
|
||||||
match = strings.HasSuffix(attr.Value(), value[1:])
|
match = strings.HasSuffix(attr.GetValue(), value[1:])
|
||||||
default:
|
default:
|
||||||
match = attr.Value() == value
|
match = attr.GetValue() == value
|
||||||
}
|
}
|
||||||
if match {
|
if match {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -246,7 +246,7 @@ func (t *FSTree) Delete(ctx context.Context, prm common.DeletePrm) (common.Delet
|
||||||
|
|
||||||
err = os.Remove(p)
|
err = os.Remove(p)
|
||||||
if err != nil && os.IsNotExist(err) {
|
if err != nil && os.IsNotExist(err) {
|
||||||
err = logicerr.Wrap(apistatus.ObjectNotFound{})
|
err = logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
return common.DeleteRes{}, err
|
return common.DeleteRes{}, err
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ func (t *FSTree) Get(ctx context.Context, prm common.GetPrm) (common.GetRes, err
|
||||||
p := t.treePath(prm.Address)
|
p := t.treePath(prm.Address)
|
||||||
|
|
||||||
if _, err := os.Stat(p); os.IsNotExist(err) {
|
if _, err := os.Stat(p); os.IsNotExist(err) {
|
||||||
return common.GetRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
var data []byte
|
var data []byte
|
||||||
|
@ -498,7 +498,7 @@ func (t *FSTree) GetRange(ctx context.Context, prm common.GetRangePrm) (common.G
|
||||||
to := from + prm.Range.GetLength()
|
to := from + prm.Range.GetLength()
|
||||||
|
|
||||||
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
||||||
return common.GetRangeRes{}, logicerr.Wrap(apistatus.ObjectOutOfRange{})
|
return common.GetRangeRes{}, logicerr.Wrap(apistatus.NewObjectOutOfRange())
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true
|
success = true
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (b *BlobStor) Get(ctx context.Context, prm common.GetPrm) (res common.GetRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return common.GetRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
if len(prm.StorageID) == 0 {
|
if len(prm.StorageID) == 0 {
|
||||||
res, err = b.storage[len(b.storage)-1].Storage.Get(ctx, prm)
|
res, err = b.storage[len(b.storage)-1].Storage.Get(ctx, prm)
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (b *BlobStor) GetRange(ctx context.Context, prm common.GetRangePrm) (res co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return common.GetRangeRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRangeRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
if len(prm.StorageID) == 0 {
|
if len(prm.StorageID) == 0 {
|
||||||
res, err = b.storage[len(b.storage)-1].Storage.GetRange(ctx, prm)
|
res, err = b.storage[len(b.storage)-1].Storage.GetRange(ctx, prm)
|
||||||
|
|
|
@ -32,13 +32,13 @@ func TestGet(t *testing.T, cons Constructor, min, max uint64) {
|
||||||
gPrm.StorageID = objects[i].storageID
|
gPrm.StorageID = objects[i].storageID
|
||||||
res, err := s.Get(context.Background(), gPrm)
|
res, err := s.Get(context.Background(), gPrm)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, objects[i].obj, res.Object)
|
require.True(t, objects[i].obj.Equal(res.Object))
|
||||||
|
|
||||||
// Without storage ID.
|
// Without storage ID.
|
||||||
gPrm.StorageID = nil
|
gPrm.StorageID = nil
|
||||||
res, err = s.Get(context.Background(), gPrm)
|
res, err = s.Get(context.Background(), gPrm)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, objects[i].obj, res.Object)
|
require.True(t, objects[i].obj.Equal(res.Object))
|
||||||
|
|
||||||
// With raw flag.
|
// With raw flag.
|
||||||
gPrm.StorageID = objects[i].storageID
|
gPrm.StorageID = objects[i].storageID
|
||||||
|
@ -46,6 +46,6 @@ func TestGet(t *testing.T, cons Constructor, min, max uint64) {
|
||||||
|
|
||||||
res, err = s.Get(context.Background(), gPrm)
|
res, err = s.Get(context.Background(), gPrm)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, objects[i].raw, res.RawData)
|
require.True(t, objects[i].obj.Equal(res.Object))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
|
oidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -34,6 +35,7 @@ func TestGetRange(t *testing.T, cons Constructor, min, max uint64) {
|
||||||
|
|
||||||
var gPrm common.GetRangePrm
|
var gPrm common.GetRangePrm
|
||||||
gPrm.Address = objects[0].addr
|
gPrm.Address = objects[0].addr
|
||||||
|
gPrm.Range = *object.NewRange()
|
||||||
gPrm.Range.SetOffset(start)
|
gPrm.Range.SetOffset(start)
|
||||||
gPrm.Range.SetLength(stop - start)
|
gPrm.Range.SetLength(stop - start)
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ func (s *memstoreImpl) Get(_ context.Context, req common.GetPrm) (common.GetRes,
|
||||||
s.mu.RUnlock()
|
s.mu.RUnlock()
|
||||||
|
|
||||||
if !exists {
|
if !exists {
|
||||||
return common.GetRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.GetRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decompress the data.
|
// Decompress the data.
|
||||||
|
@ -73,7 +73,7 @@ func (s *memstoreImpl) GetRange(ctx context.Context, req common.GetRangePrm) (co
|
||||||
to := from + req.Range.GetLength()
|
to := from + req.Range.GetLength()
|
||||||
|
|
||||||
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
||||||
return common.GetRangeRes{}, logicerr.Wrap(apistatus.ObjectOutOfRange{})
|
return common.GetRangeRes{}, logicerr.Wrap(apistatus.NewObjectOutOfRange())
|
||||||
}
|
}
|
||||||
|
|
||||||
return common.GetRangeRes{
|
return common.GetRangeRes{
|
||||||
|
@ -123,7 +123,7 @@ func (s *memstoreImpl) Delete(_ context.Context, req common.DeletePrm) (common.D
|
||||||
return common.DeleteRes{}, nil
|
return common.DeleteRes{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return common.DeleteRes{}, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return common.DeleteRes{}, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *memstoreImpl) Iterate(_ context.Context, req common.IteratePrm) (common.IterateRes, error) {
|
func (s *memstoreImpl) Iterate(_ context.Context, req common.IteratePrm) (common.IterateRes, error) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ func TestSimpleLifecycle(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
var objRange objectSDK.Range
|
objRange := *objectSDK.NewRange()
|
||||||
objRange.SetOffset(256)
|
objRange.SetOffset(256)
|
||||||
objRange.SetLength(512)
|
objRange.SetLength(512)
|
||||||
resp, err := s.GetRange(context.Background(), common.GetRangePrm{
|
resp, err := s.GetRange(context.Background(), common.GetRangePrm{
|
||||||
|
|
|
@ -84,10 +84,10 @@ func TestDeleteBigObject(t *testing.T) {
|
||||||
_, err := e.Delete(context.Background(), deletePrm)
|
_, err := e.Delete(context.Background(), deletePrm)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
checkGetError(t, e, addrParent, &apistatus.ObjectNotFound{})
|
checkGetError(t, e, addrParent, apistatus.NewObjectNotFound())
|
||||||
checkGetError(t, e, addrLink, &apistatus.ObjectNotFound{})
|
checkGetError(t, e, addrLink, apistatus.NewObjectNotFound())
|
||||||
for i := range children {
|
for i := range children {
|
||||||
checkGetError(t, e, object.AddressOf(children[i]), &apistatus.ObjectNotFound{})
|
checkGetError(t, e, object.AddressOf(children[i]), apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ func TestBlobstorFailback(t *testing.T) {
|
||||||
addr := object.AddressOf(objs[i])
|
addr := object.AddressOf(objs[i])
|
||||||
getRes, err := te.ng.Get(context.Background(), GetPrm{addr: addr})
|
getRes, err := te.ng.Get(context.Background(), GetPrm{addr: addr})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, objs[i], getRes.Object())
|
require.True(t, objs[i].Equal(getRes.Object()))
|
||||||
|
|
||||||
rngRes, err := te.ng.GetRange(context.Background(), RngPrm{addr: addr, off: 1, ln: 10})
|
rngRes, err := te.ng.GetRange(context.Background(), RngPrm{addr: addr, off: 1, ln: 10})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -150,7 +150,7 @@ func TestEvacuateNetwork(t *testing.T) {
|
||||||
n++
|
n++
|
||||||
for i := range objects {
|
for i := range objects {
|
||||||
if addr == objectCore.AddressOf(objects[i]) {
|
if addr == objectCore.AddressOf(objects[i]) {
|
||||||
require.Equal(t, objects[i], obj)
|
require.True(t, objects[i].Equal(obj))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (e *StorageEngine) exists(ctx context.Context, addr oid.Address) (bool, err
|
||||||
})
|
})
|
||||||
|
|
||||||
if alreadyRemoved {
|
if alreadyRemoved {
|
||||||
var errRemoved apistatus.ObjectAlreadyRemoved
|
errRemoved := apistatus.NewObjectAlreadyRemoved()
|
||||||
|
|
||||||
return false, errRemoved
|
return false, errRemoved
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (e *StorageEngine) get(ctx context.Context, prm GetPrm) (GetRes, error) {
|
||||||
defer elapsed("Get", e.metrics.AddMethodDuration)()
|
defer elapsed("Get", e.metrics.AddMethodDuration)()
|
||||||
}
|
}
|
||||||
|
|
||||||
var errNotFound apistatus.ObjectNotFound
|
errNotFound := apistatus.NewObjectNotFound()
|
||||||
|
|
||||||
var shPrm shard.GetPrm
|
var shPrm shard.GetPrm
|
||||||
shPrm.SetAddress(prm.addr)
|
shPrm.SetAddress(prm.addr)
|
||||||
|
|
|
@ -75,7 +75,7 @@ func (e *StorageEngine) head(ctx context.Context, prm HeadPrm) (HeadRes, error)
|
||||||
head *objectSDK.Object
|
head *objectSDK.Object
|
||||||
siErr *objectSDK.SplitInfoError
|
siErr *objectSDK.SplitInfoError
|
||||||
|
|
||||||
errNotFound apistatus.ObjectNotFound
|
errNotFound = apistatus.NewObjectNotFound()
|
||||||
|
|
||||||
outSI *objectSDK.SplitInfo
|
outSI *objectSDK.SplitInfo
|
||||||
outError error = errNotFound
|
outError error = errNotFound
|
||||||
|
@ -112,7 +112,7 @@ func (e *StorageEngine) head(ctx context.Context, prm HeadPrm) (HeadRes, error)
|
||||||
|
|
||||||
return true // stop, return it back
|
return true // stop, return it back
|
||||||
case shard.IsErrObjectExpired(err):
|
case shard.IsErrObjectExpired(err):
|
||||||
var notFoundErr apistatus.ObjectNotFound
|
notFoundErr := apistatus.NewObjectNotFound()
|
||||||
|
|
||||||
// object is found but should not
|
// object is found but should not
|
||||||
// be returned
|
// be returned
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (e *StorageEngine) inhume(ctx context.Context, prm InhumePrm) (InhumeRes, e
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.Stringer("addr", prm.addrs[i]))
|
zap.Stringer("addr", prm.addrs[i]))
|
||||||
} else if locked {
|
} else if locked {
|
||||||
var lockedErr apistatus.ObjectLocked
|
lockedErr := apistatus.NewObjectLocked()
|
||||||
return InhumeRes{}, lockedErr
|
return InhumeRes{}, lockedErr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ func (e *StorageEngine) inhume(ctx context.Context, prm InhumePrm) (InhumeRes, e
|
||||||
// Returns ok if object was inhumed during this invocation or before.
|
// Returns ok if object was inhumed during this invocation or before.
|
||||||
func (e *StorageEngine) inhumeAddr(ctx context.Context, addr oid.Address, prm shard.InhumePrm, checkExists bool) (bool, error) {
|
func (e *StorageEngine) inhumeAddr(ctx context.Context, addr oid.Address, prm shard.InhumePrm, checkExists bool) (bool, error) {
|
||||||
root := false
|
root := false
|
||||||
var errLocked apistatus.ObjectLocked
|
errLocked := apistatus.NewObjectLocked()
|
||||||
var existPrm shard.ExistsPrm
|
var existPrm shard.ExistsPrm
|
||||||
var retErr error
|
var retErr error
|
||||||
var ok bool
|
var ok bool
|
||||||
|
@ -165,7 +165,7 @@ func (e *StorageEngine) inhumeAddr(ctx context.Context, addr oid.Address, prm sh
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
case errors.As(err, &errLocked):
|
case errors.As(err, &errLocked):
|
||||||
retErr = apistatus.ObjectLocked{}
|
retErr = apistatus.NewObjectLocked()
|
||||||
return true
|
return true
|
||||||
case errors.Is(err, shard.ErrLockObjectRemoval):
|
case errors.Is(err, shard.ErrLockObjectRemoval):
|
||||||
retErr = meta.ErrLockObjectRemoval
|
retErr = meta.ErrLockObjectRemoval
|
||||||
|
|
|
@ -41,11 +41,11 @@ func (e *StorageEngine) lock(ctx context.Context, idCnr cid.ID, locker oid.ID, l
|
||||||
for i := range locked {
|
for i := range locked {
|
||||||
switch e.lockSingle(ctx, idCnr, locker, locked[i], true) {
|
switch e.lockSingle(ctx, idCnr, locker, locked[i], true) {
|
||||||
case 1:
|
case 1:
|
||||||
return logicerr.Wrap(apistatus.LockNonRegularObject{})
|
return logicerr.Wrap(apistatus.NewLockNonRegularObject())
|
||||||
case 0:
|
case 0:
|
||||||
switch e.lockSingle(ctx, idCnr, locker, locked[i], false) {
|
switch e.lockSingle(ctx, idCnr, locker, locked[i], false) {
|
||||||
case 1:
|
case 1:
|
||||||
return logicerr.Wrap(apistatus.LockNonRegularObject{})
|
return logicerr.Wrap(apistatus.NewLockNonRegularObject())
|
||||||
case 0:
|
case 0:
|
||||||
return logicerr.Wrap(errLockFailed)
|
return logicerr.Wrap(errLockFailed)
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ func (e *StorageEngine) lock(ctx context.Context, idCnr cid.ID, locker oid.ID, l
|
||||||
func (e *StorageEngine) lockSingle(ctx context.Context, idCnr cid.ID, locker, locked oid.ID, checkExists bool) (status uint8) {
|
func (e *StorageEngine) lockSingle(ctx context.Context, idCnr cid.ID, locker, locked oid.ID, checkExists bool) (status uint8) {
|
||||||
// code is pretty similar to inhumeAddr, maybe unify?
|
// code is pretty similar to inhumeAddr, maybe unify?
|
||||||
root := false
|
root := false
|
||||||
var errIrregular apistatus.LockNonRegularObject
|
errIrregular := apistatus.NewLockNonRegularObject()
|
||||||
|
|
||||||
var addrLocked oid.Address
|
var addrLocked oid.Address
|
||||||
addrLocked.SetContainer(idCnr)
|
addrLocked.SetContainer(idCnr)
|
||||||
|
|
|
@ -83,7 +83,7 @@ func TestLockUserScenario(t *testing.T) {
|
||||||
lockerAddr.SetContainer(cnr)
|
lockerAddr.SetContainer(cnr)
|
||||||
lockerAddr.SetObject(lockerID)
|
lockerAddr.SetObject(lockerID)
|
||||||
|
|
||||||
var a objectSDK.Attribute
|
a := *objectSDK.NewAttribute()
|
||||||
a.SetKey(objectV2.SysAttributeExpEpoch)
|
a.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
a.SetValue(strconv.Itoa(lockerExpiresAfter))
|
a.SetValue(strconv.Itoa(lockerExpiresAfter))
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ func TestLockUserScenario(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
var locker objectSDK.Lock
|
locker := *objectSDK.NewLock()
|
||||||
locker.WriteMembers([]oid.ID{id})
|
locker.WriteMembers([]oid.ID{id})
|
||||||
objectSDK.WriteLock(lockerObj, locker)
|
objectSDK.WriteLock(lockerObj, locker)
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ func TestLockExpiration(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// 2.
|
// 2.
|
||||||
var a objectSDK.Attribute
|
a := *objectSDK.NewAttribute()
|
||||||
a.SetKey(objectV2.SysAttributeExpEpoch)
|
a.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
a.SetValue(strconv.Itoa(lockerExpiresAfter))
|
a.SetValue(strconv.Itoa(lockerExpiresAfter))
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ func (e *StorageEngine) getRange(ctx context.Context, prm RngPrm) (RngRes, error
|
||||||
defer elapsed("GetRange", e.metrics.AddMethodDuration)()
|
defer elapsed("GetRange", e.metrics.AddMethodDuration)()
|
||||||
}
|
}
|
||||||
|
|
||||||
var errNotFound apistatus.ObjectNotFound
|
errNotFound := apistatus.NewObjectNotFound()
|
||||||
|
|
||||||
var shPrm shard.RngPrm
|
var shPrm shard.RngPrm
|
||||||
shPrm.SetAddress(prm.addr)
|
shPrm.SetAddress(prm.addr)
|
||||||
|
@ -212,7 +212,7 @@ func (i *getRangeShardIterator) tryGetFromBlobstor(ctx context.Context) {
|
||||||
|
|
||||||
res, err := sh.GetRange(ctx, i.ShardPrm)
|
res, err := sh.GetRange(ctx, i.ShardPrm)
|
||||||
if shard.IsErrOutOfRange(err) {
|
if shard.IsErrOutOfRange(err) {
|
||||||
var errOutOfRange apistatus.ObjectOutOfRange
|
errOutOfRange := apistatus.NewObjectOutOfRange()
|
||||||
|
|
||||||
i.OutError = errOutOfRange
|
i.OutError = errOutOfRange
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -27,21 +27,21 @@ func GenerateObjectWithCID(cnr cid.ID) *objectSDK.Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *objectSDK.Object {
|
func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *objectSDK.Object {
|
||||||
var ver version.Version
|
ver := version.NewVersion()
|
||||||
ver.SetMajor(2)
|
ver.SetMajor(2)
|
||||||
ver.SetMinor(1)
|
ver.SetMinor(1)
|
||||||
|
|
||||||
var csum checksum.Checksum
|
csum := checksum.NewChecksum()
|
||||||
csum.SetSHA256(sha256.Sum256(data))
|
csum.SetSHA256(sha256.Sum256(data))
|
||||||
|
|
||||||
var csumTZ checksum.Checksum
|
csumTZ := checksum.NewChecksum()
|
||||||
csumTZ.SetTillichZemor(tz.Sum(csum.Value()))
|
csumTZ.SetTillichZemor(tz.Sum(csum.Value()))
|
||||||
|
|
||||||
obj := objectSDK.New()
|
obj := objectSDK.New()
|
||||||
obj.SetID(oidtest.ID())
|
obj.SetID(oidtest.ID())
|
||||||
obj.SetOwnerID(usertest.ID())
|
obj.SetOwnerID(usertest.ID())
|
||||||
obj.SetContainerID(cnr)
|
obj.SetContainerID(cnr)
|
||||||
obj.SetVersion(&ver)
|
obj.SetVersion(ver)
|
||||||
obj.SetPayload(data)
|
obj.SetPayload(data)
|
||||||
obj.SetPayloadChecksum(csum)
|
obj.SetPayloadChecksum(csum)
|
||||||
obj.SetPayloadHomomorphicHash(csumTZ)
|
obj.SetPayloadHomomorphicHash(csumTZ)
|
||||||
|
@ -50,7 +50,7 @@ func GenerateObjectWithCIDWithPayload(cnr cid.ID, data []byte) *objectSDK.Object
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddAttribute(obj *objectSDK.Object, key, val string) {
|
func AddAttribute(obj *objectSDK.Object, key, val string) {
|
||||||
var attr objectSDK.Attribute
|
attr := *objectSDK.NewAttribute()
|
||||||
attr.SetKey(key)
|
attr.SetKey(key)
|
||||||
attr.SetValue(val)
|
attr.SetValue(val)
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ func checkExpiredObjects(t *testing.T, db *meta.DB, f func(exp, nonExp *objectSD
|
||||||
}
|
}
|
||||||
|
|
||||||
func setExpiration(o *objectSDK.Object, epoch uint64) {
|
func setExpiration(o *objectSDK.Object, epoch uint64) {
|
||||||
var attr objectSDK.Attribute
|
attr := *objectSDK.NewAttribute()
|
||||||
|
|
||||||
attr.SetKey(objectV2.SysAttributeExpEpoch)
|
attr.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
attr.SetValue(strconv.FormatUint(epoch, 10))
|
attr.SetValue(strconv.FormatUint(epoch, 10))
|
||||||
|
|
|
@ -82,9 +82,9 @@ func (db *DB) exists(tx *bbolt.Tx, addr oid.Address, currEpoch uint64) (exists b
|
||||||
// check graveyard and object expiration first
|
// check graveyard and object expiration first
|
||||||
switch objectStatus(tx, addr, currEpoch) {
|
switch objectStatus(tx, addr, currEpoch) {
|
||||||
case 1:
|
case 1:
|
||||||
return false, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return false, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
case 2:
|
case 2:
|
||||||
return false, logicerr.Wrap(apistatus.ObjectAlreadyRemoved{})
|
return false, logicerr.Wrap(apistatus.NewObjectAlreadyRemoved())
|
||||||
case 3:
|
case 3:
|
||||||
return false, ErrObjectIsExpired
|
return false, ErrObjectIsExpired
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,9 @@ func (db *DB) get(tx *bbolt.Tx, addr oid.Address, key []byte, checkStatus, raw b
|
||||||
if checkStatus {
|
if checkStatus {
|
||||||
switch objectStatus(tx, addr, currEpoch) {
|
switch objectStatus(tx, addr, currEpoch) {
|
||||||
case 1:
|
case 1:
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return nil, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
case 2:
|
case 2:
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectAlreadyRemoved{})
|
return nil, logicerr.Wrap(apistatus.NewObjectAlreadyRemoved())
|
||||||
case 3:
|
case 3:
|
||||||
return nil, ErrObjectIsExpired
|
return nil, ErrObjectIsExpired
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ func getVirtualObject(tx *bbolt.Tx, cnr cid.ID, key []byte, raw bool) (*objectSD
|
||||||
bucketName := make([]byte, bucketKeySize)
|
bucketName := make([]byte, bucketKeySize)
|
||||||
parentBucket := tx.Bucket(parentBucketName(cnr, bucketName))
|
parentBucket := tx.Bucket(parentBucketName(cnr, bucketName))
|
||||||
if parentBucket == nil {
|
if parentBucket == nil {
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return nil, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
relativeLst, err := decodeList(parentBucket.Get(key))
|
relativeLst, err := decodeList(parentBucket.Get(key))
|
||||||
|
@ -152,7 +152,7 @@ func getVirtualObject(tx *bbolt.Tx, cnr cid.ID, key []byte, raw bool) (*objectSD
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(relativeLst) == 0 { // this should never happen though
|
if len(relativeLst) == 0 { // this should never happen though
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return nil, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
// pick last item, for now there is not difference which address to pick
|
// pick last item, for now there is not difference which address to pick
|
||||||
|
@ -171,7 +171,7 @@ func getVirtualObject(tx *bbolt.Tx, cnr cid.ID, key []byte, raw bool) (*objectSD
|
||||||
par := child.Parent()
|
par := child.Parent()
|
||||||
|
|
||||||
if par == nil { // this should never happen though
|
if par == nil { // this should never happen though
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return nil, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
return par, nil
|
return par, nil
|
||||||
|
@ -183,5 +183,5 @@ func getSplitInfoError(tx *bbolt.Tx, cnr cid.ID, key []byte) error {
|
||||||
return logicerr.Wrap(objectSDK.NewSplitInfoError(splitInfo))
|
return logicerr.Wrap(objectSDK.NewSplitInfoError(splitInfo))
|
||||||
}
|
}
|
||||||
|
|
||||||
return logicerr.Wrap(apistatus.ObjectNotFound{})
|
return logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ func (db *DB) inhumeTx(tx *bbolt.Tx, epoch uint64, prm InhumePrm, res *InhumeRes
|
||||||
|
|
||||||
// prevent locked objects to be inhumed
|
// prevent locked objects to be inhumed
|
||||||
if !prm.forceRemoval && objectLocked(tx, cnr, id) {
|
if !prm.forceRemoval && objectLocked(tx, cnr, id) {
|
||||||
return apistatus.ObjectLocked{}
|
return apistatus.NewObjectLocked()
|
||||||
}
|
}
|
||||||
|
|
||||||
var lockWasChecked bool
|
var lockWasChecked bool
|
||||||
|
|
|
@ -109,7 +109,7 @@ func TestInhumeLocked(t *testing.T) {
|
||||||
|
|
||||||
_, err = db.Inhume(context.Background(), prm)
|
_, err = db.Inhume(context.Background(), prm)
|
||||||
|
|
||||||
var e apistatus.ObjectLocked
|
e := apistatus.NewObjectLocked()
|
||||||
require.ErrorAs(t, err, &e)
|
require.ErrorAs(t, err, &e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ func (db *DB) lockInternal(locked []oid.ID, cnr cid.ID, locker oid.ID) error {
|
||||||
|
|
||||||
return metaerr.Wrap(db.boltDB.Update(func(tx *bbolt.Tx) error {
|
return metaerr.Wrap(db.boltDB.Update(func(tx *bbolt.Tx) error {
|
||||||
if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != objectSDK.TypeRegular {
|
if firstIrregularObjectType(tx, cnr, bucketKeysLocked...) != objectSDK.TypeRegular {
|
||||||
return logicerr.Wrap(apistatus.LockNonRegularObject{})
|
return logicerr.Wrap(apistatus.NewLockNonRegularObject())
|
||||||
}
|
}
|
||||||
|
|
||||||
bucketLocked := tx.Bucket(bucketNameLocked)
|
bucketLocked := tx.Bucket(bucketNameLocked)
|
||||||
|
|
|
@ -344,10 +344,10 @@ func updateFKBTIndexes(tx *bbolt.Tx, obj *objectSDK.Object, f updateIndexItemFun
|
||||||
|
|
||||||
// user specified attributes
|
// user specified attributes
|
||||||
for i := range attrs {
|
for i := range attrs {
|
||||||
key = attributeBucketName(cnr, attrs[i].Key(), key)
|
key = attributeBucketName(cnr, attrs[i].GetKey(), key)
|
||||||
err := f(tx, namedBucketItem{
|
err := f(tx, namedBucketItem{
|
||||||
name: key,
|
name: key,
|
||||||
key: []byte(attrs[i].Value()),
|
key: []byte(attrs[i].GetValue()),
|
||||||
val: objKey,
|
val: objKey,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -8,7 +8,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
objectapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
||||||
|
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/metaerr"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
||||||
|
@ -193,27 +194,27 @@ func (db *DB) selectFastFilter(
|
||||||
currEpoch := db.epochState.CurrentEpoch()
|
currEpoch := db.epochState.CurrentEpoch()
|
||||||
bucketName := make([]byte, bucketKeySize)
|
bucketName := make([]byte, bucketKeySize)
|
||||||
switch f.Header() {
|
switch f.Header() {
|
||||||
case v2object.FilterHeaderObjectID:
|
case objectapi.FilterHeaderObjectID:
|
||||||
db.selectObjectID(tx, f, cnr, to, fNum, currEpoch)
|
db.selectObjectID(tx, f, cnr, to, fNum, currEpoch)
|
||||||
case v2object.FilterHeaderOwnerID:
|
case objectapi.FilterHeaderOwnerID:
|
||||||
bucketName := ownerBucketName(cnr, bucketName)
|
bucketName := ownerBucketName(cnr, bucketName)
|
||||||
db.selectFromFKBT(tx, bucketName, f, to, fNum)
|
db.selectFromFKBT(tx, bucketName, f, to, fNum)
|
||||||
case v2object.FilterHeaderPayloadHash:
|
case objectapi.FilterHeaderPayloadHash:
|
||||||
bucketName := payloadHashBucketName(cnr, bucketName)
|
bucketName := payloadHashBucketName(cnr, bucketName)
|
||||||
db.selectFromList(tx, bucketName, f, to, fNum)
|
db.selectFromList(tx, bucketName, f, to, fNum)
|
||||||
case v2object.FilterHeaderObjectType:
|
case objectapi.FilterHeaderObjectType:
|
||||||
for _, bucketName := range bucketNamesForType(cnr, f.Operation(), f.Value()) {
|
for _, bucketName := range bucketNamesForType(cnr, f.Operation(), f.Value()) {
|
||||||
selectAllFromBucket(tx, bucketName, to, fNum)
|
selectAllFromBucket(tx, bucketName, to, fNum)
|
||||||
}
|
}
|
||||||
case v2object.FilterHeaderParent:
|
case objectapi.FilterHeaderParent:
|
||||||
bucketName := parentBucketName(cnr, bucketName)
|
bucketName := parentBucketName(cnr, bucketName)
|
||||||
db.selectFromList(tx, bucketName, f, to, fNum)
|
db.selectFromList(tx, bucketName, f, to, fNum)
|
||||||
case v2object.FilterHeaderSplitID:
|
case objectapi.FilterHeaderSplitID:
|
||||||
bucketName := splitBucketName(cnr, bucketName)
|
bucketName := splitBucketName(cnr, bucketName)
|
||||||
db.selectFromList(tx, bucketName, f, to, fNum)
|
db.selectFromList(tx, bucketName, f, to, fNum)
|
||||||
case v2object.FilterPropertyRoot:
|
case objectapi.FilterPropertyRoot:
|
||||||
selectAllFromBucket(tx, rootBucketName(cnr, bucketName), to, fNum)
|
selectAllFromBucket(tx, rootBucketName(cnr, bucketName), to, fNum)
|
||||||
case v2object.FilterPropertyPhy:
|
case objectapi.FilterPropertyPhy:
|
||||||
selectAllFromBucket(tx, primaryBucketName(cnr, bucketName), to, fNum)
|
selectAllFromBucket(tx, primaryBucketName(cnr, bucketName), to, fNum)
|
||||||
selectAllFromBucket(tx, tombstoneBucketName(cnr, bucketName), to, fNum)
|
selectAllFromBucket(tx, tombstoneBucketName(cnr, bucketName), to, fNum)
|
||||||
selectAllFromBucket(tx, bucketNameLockers(cnr, bucketName), to, fNum)
|
selectAllFromBucket(tx, bucketNameLockers(cnr, bucketName), to, fNum)
|
||||||
|
@ -229,9 +230,9 @@ func (db *DB) selectFastFilter(
|
||||||
}
|
}
|
||||||
|
|
||||||
var mBucketNaming = map[string][]func(cid.ID, []byte) []byte{
|
var mBucketNaming = map[string][]func(cid.ID, []byte) []byte{
|
||||||
v2object.TypeRegular.String(): {primaryBucketName, parentBucketName},
|
objectGRPC.ObjectType_REGULAR.String(): {primaryBucketName, parentBucketName},
|
||||||
v2object.TypeTombstone.String(): {tombstoneBucketName},
|
objectGRPC.ObjectType_TOMBSTONE.String(): {tombstoneBucketName},
|
||||||
v2object.TypeLock.String(): {bucketNameLockers},
|
objectGRPC.ObjectType_LOCK.String(): {bucketNameLockers},
|
||||||
}
|
}
|
||||||
|
|
||||||
func allBucketNames(cnr cid.ID) (names [][]byte) {
|
func allBucketNames(cnr cid.ID) (names [][]byte) {
|
||||||
|
@ -495,15 +496,15 @@ func (db *DB) matchSlowFilters(tx *bbolt.Tx, addr oid.Address, f objectSDK.Searc
|
||||||
var data []byte
|
var data []byte
|
||||||
|
|
||||||
switch f[i].Header() {
|
switch f[i].Header() {
|
||||||
case v2object.FilterHeaderVersion:
|
case objectapi.FilterHeaderVersion:
|
||||||
data = []byte(obj.Version().String())
|
data = []byte(obj.Version().String())
|
||||||
case v2object.FilterHeaderHomomorphicHash:
|
case objectapi.FilterHeaderHomomorphicHash:
|
||||||
cs, _ := obj.PayloadHomomorphicHash()
|
cs, _ := obj.PayloadHomomorphicHash()
|
||||||
data = cs.Value()
|
data = cs.Value()
|
||||||
case v2object.FilterHeaderCreationEpoch:
|
case objectapi.FilterHeaderCreationEpoch:
|
||||||
data = make([]byte, 8)
|
data = make([]byte, 8)
|
||||||
binary.LittleEndian.PutUint64(data, obj.CreationEpoch())
|
binary.LittleEndian.PutUint64(data, obj.CreationEpoch())
|
||||||
case v2object.FilterHeaderPayloadLength:
|
case objectapi.FilterHeaderPayloadLength:
|
||||||
data = make([]byte, 8)
|
data = make([]byte, 8)
|
||||||
binary.LittleEndian.PutUint64(data, obj.PayloadSize())
|
binary.LittleEndian.PutUint64(data, obj.PayloadSize())
|
||||||
default:
|
default:
|
||||||
|
@ -529,7 +530,7 @@ func groupFilters(filters objectSDK.SearchFilters) (filterGroup, error) {
|
||||||
|
|
||||||
for i := range filters {
|
for i := range filters {
|
||||||
switch filters[i].Header() {
|
switch filters[i].Header() {
|
||||||
case v2object.FilterHeaderContainerID: // support deprecated field
|
case objectapi.FilterHeaderContainerID: // support deprecated field
|
||||||
err := res.cnr.DecodeString(filters[i].Value())
|
err := res.cnr.DecodeString(filters[i].Value())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return filterGroup{}, fmt.Errorf("can't parse container id: %w", err)
|
return filterGroup{}, fmt.Errorf("can't parse container id: %w", err)
|
||||||
|
@ -537,10 +538,10 @@ func groupFilters(filters objectSDK.SearchFilters) (filterGroup, error) {
|
||||||
|
|
||||||
res.withCnrFilter = true
|
res.withCnrFilter = true
|
||||||
case // slow filters
|
case // slow filters
|
||||||
v2object.FilterHeaderVersion,
|
objectapi.FilterHeaderVersion,
|
||||||
v2object.FilterHeaderCreationEpoch,
|
objectapi.FilterHeaderCreationEpoch,
|
||||||
v2object.FilterHeaderPayloadLength,
|
objectapi.FilterHeaderPayloadLength,
|
||||||
v2object.FilterHeaderHomomorphicHash:
|
objectapi.FilterHeaderHomomorphicHash:
|
||||||
res.slowFilters = append(res.slowFilters, filters[i])
|
res.slowFilters = append(res.slowFilters, filters[i])
|
||||||
default: // fast filters or user attributes if unknown
|
default: // fast filters or user attributes if unknown
|
||||||
res.fastFilters = append(res.fastFilters, filters[i])
|
res.fastFilters = append(res.fastFilters, filters[i])
|
||||||
|
@ -569,5 +570,6 @@ func checkNonEmpty(fs objectSDK.SearchFilters) bool {
|
||||||
|
|
||||||
// returns true if string key is a reserved system filter key.
|
// returns true if string key is a reserved system filter key.
|
||||||
func isSystemKey(key string) bool {
|
func isSystemKey(key string) bool {
|
||||||
return strings.HasPrefix(key, v2object.ReservedFilterPrefix)
|
// FIXME: #1147 version-dependent approach
|
||||||
|
return strings.HasPrefix(key, objectapi.ReservedFilterPrefix)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
objectapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
||||||
|
objectGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/internal/testutil"
|
||||||
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
||||||
|
@ -199,7 +200,7 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterPropertyRoot, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterPropertyRoot, "", objectSDK.MatchNotPresent)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -216,13 +217,13 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterPropertyPhy, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterPropertyPhy, "", objectSDK.MatchNotPresent)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("regular objects", func(t *testing.T) {
|
t.Run("regular objects", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderObjectType, v2object.TypeRegular.String(), objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderObjectType, objectGRPC.ObjectType_REGULAR.String(), objectSDK.MatchStringEqual)
|
||||||
testSelect(t, db, cnr, fs,
|
testSelect(t, db, cnr, fs,
|
||||||
object.AddressOf(small),
|
object.AddressOf(small),
|
||||||
object.AddressOf(leftChild),
|
object.AddressOf(leftChild),
|
||||||
|
@ -232,24 +233,24 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderObjectType, v2object.TypeRegular.String(), objectSDK.MatchStringNotEqual)
|
fs.AddFilter(objectapi.FilterHeaderObjectType, objectGRPC.ObjectType_REGULAR.String(), objectSDK.MatchStringNotEqual)
|
||||||
testSelect(t, db, cnr, fs,
|
testSelect(t, db, cnr, fs,
|
||||||
object.AddressOf(ts),
|
object.AddressOf(ts),
|
||||||
object.AddressOf(lock),
|
object.AddressOf(lock),
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderObjectType, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterHeaderObjectType, "", objectSDK.MatchNotPresent)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("tombstone objects", func(t *testing.T) {
|
t.Run("tombstone objects", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderObjectType, v2object.TypeTombstone.String(), objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderObjectType, objectGRPC.ObjectType_TOMBSTONE.String(), objectSDK.MatchStringEqual)
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(ts))
|
testSelect(t, db, cnr, fs, object.AddressOf(ts))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderObjectType, v2object.TypeTombstone.String(), objectSDK.MatchStringNotEqual)
|
fs.AddFilter(objectapi.FilterHeaderObjectType, objectGRPC.ObjectType_TOMBSTONE.String(), objectSDK.MatchStringNotEqual)
|
||||||
testSelect(t, db, cnr, fs,
|
testSelect(t, db, cnr, fs,
|
||||||
object.AddressOf(small),
|
object.AddressOf(small),
|
||||||
object.AddressOf(leftChild),
|
object.AddressOf(leftChild),
|
||||||
|
@ -260,7 +261,7 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderObjectType, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterHeaderObjectType, "", objectSDK.MatchNotPresent)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
idParent, _ := parent.ID()
|
idParent, _ := parent.ID()
|
||||||
|
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderParent,
|
fs.AddFilter(objectapi.FilterHeaderParent,
|
||||||
idParent.EncodeToString(),
|
idParent.EncodeToString(),
|
||||||
objectSDK.MatchStringEqual)
|
objectSDK.MatchStringEqual)
|
||||||
|
|
||||||
|
@ -278,7 +279,7 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderParent, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterHeaderParent, "", objectSDK.MatchNotPresent)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -349,28 +350,28 @@ func TestDB_SelectPayloadHash(t *testing.T) {
|
||||||
payloadHash := hex.EncodeToString(cs.Value())
|
payloadHash := hex.EncodeToString(cs.Value())
|
||||||
|
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
payloadHash,
|
payloadHash,
|
||||||
objectSDK.MatchStringEqual)
|
objectSDK.MatchStringEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
payloadHash[:len(payloadHash)-1],
|
payloadHash[:len(payloadHash)-1],
|
||||||
objectSDK.MatchCommonPrefix)
|
objectSDK.MatchCommonPrefix)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
payloadHash,
|
payloadHash,
|
||||||
objectSDK.MatchStringNotEqual)
|
objectSDK.MatchStringNotEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
"",
|
"",
|
||||||
objectSDK.MatchNotPresent)
|
objectSDK.MatchNotPresent)
|
||||||
|
|
||||||
|
@ -378,21 +379,21 @@ func TestDB_SelectPayloadHash(t *testing.T) {
|
||||||
|
|
||||||
t.Run("invalid hashes", func(t *testing.T) {
|
t.Run("invalid hashes", func(t *testing.T) {
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
payloadHash[:len(payloadHash)-1],
|
payloadHash[:len(payloadHash)-1],
|
||||||
objectSDK.MatchStringNotEqual)
|
objectSDK.MatchStringNotEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1), object.AddressOf(raw2))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1), object.AddressOf(raw2))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
payloadHash[:len(payloadHash)-2]+"x",
|
payloadHash[:len(payloadHash)-2]+"x",
|
||||||
objectSDK.MatchCommonPrefix)
|
objectSDK.MatchCommonPrefix)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadHash,
|
fs.AddFilter(objectapi.FilterHeaderPayloadHash,
|
||||||
payloadHash[:len(payloadHash)-3]+"x0",
|
payloadHash[:len(payloadHash)-3]+"x0",
|
||||||
objectSDK.MatchCommonPrefix)
|
objectSDK.MatchCommonPrefix)
|
||||||
|
|
||||||
|
@ -407,10 +408,10 @@ func TestDB_SelectWithSlowFilters(t *testing.T) {
|
||||||
|
|
||||||
cnr := cidtest.ID()
|
cnr := cidtest.ID()
|
||||||
|
|
||||||
v20 := new(version.Version)
|
v20 := version.NewVersion()
|
||||||
v20.SetMajor(2)
|
v20.SetMajor(2)
|
||||||
|
|
||||||
var v21 version.Version
|
v21 := version.NewVersion()
|
||||||
v21.SetMajor(2)
|
v21.SetMajor(2)
|
||||||
v21.SetMinor(1)
|
v21.SetMinor(1)
|
||||||
|
|
||||||
|
@ -424,7 +425,7 @@ func TestDB_SelectWithSlowFilters(t *testing.T) {
|
||||||
raw2 := testutil.GenerateObjectWithCID(cnr)
|
raw2 := testutil.GenerateObjectWithCID(cnr)
|
||||||
raw2.SetPayloadSize(20)
|
raw2.SetPayloadSize(20)
|
||||||
raw2.SetCreationEpoch(21)
|
raw2.SetCreationEpoch(21)
|
||||||
raw2.SetVersion(&v21)
|
raw2.SetVersion(v21)
|
||||||
err = putBig(db, raw2)
|
err = putBig(db, raw2)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -432,21 +433,21 @@ func TestDB_SelectWithSlowFilters(t *testing.T) {
|
||||||
cs, _ := raw1.PayloadHomomorphicHash()
|
cs, _ := raw1.PayloadHomomorphicHash()
|
||||||
|
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderHomomorphicHash,
|
fs.AddFilter(objectapi.FilterHeaderHomomorphicHash,
|
||||||
hex.EncodeToString(cs.Value()),
|
hex.EncodeToString(cs.Value()),
|
||||||
objectSDK.MatchStringEqual)
|
objectSDK.MatchStringEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderHomomorphicHash,
|
fs.AddFilter(objectapi.FilterHeaderHomomorphicHash,
|
||||||
hex.EncodeToString(cs.Value()),
|
hex.EncodeToString(cs.Value()),
|
||||||
objectSDK.MatchStringNotEqual)
|
objectSDK.MatchStringNotEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderHomomorphicHash,
|
fs.AddFilter(objectapi.FilterHeaderHomomorphicHash,
|
||||||
"",
|
"",
|
||||||
objectSDK.MatchNotPresent)
|
objectSDK.MatchNotPresent)
|
||||||
|
|
||||||
|
@ -455,39 +456,39 @@ func TestDB_SelectWithSlowFilters(t *testing.T) {
|
||||||
|
|
||||||
t.Run("object with payload length", func(t *testing.T) {
|
t.Run("object with payload length", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadLength, "20", objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderPayloadLength, "20", objectSDK.MatchStringEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadLength, "20", objectSDK.MatchStringNotEqual)
|
fs.AddFilter(objectapi.FilterHeaderPayloadLength, "20", objectSDK.MatchStringNotEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderPayloadLength, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterHeaderPayloadLength, "", objectSDK.MatchNotPresent)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("object with creation epoch", func(t *testing.T) {
|
t.Run("object with creation epoch", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderCreationEpoch, "11", objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderCreationEpoch, "11", objectSDK.MatchStringEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderCreationEpoch, "11", objectSDK.MatchStringNotEqual)
|
fs.AddFilter(objectapi.FilterHeaderCreationEpoch, "11", objectSDK.MatchStringNotEqual)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw2))
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderCreationEpoch, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterHeaderCreationEpoch, "", objectSDK.MatchNotPresent)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderCreationEpoch, "1", objectSDK.MatchCommonPrefix)
|
fs.AddFilter(objectapi.FilterHeaderCreationEpoch, "1", objectSDK.MatchCommonPrefix)
|
||||||
|
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
testSelect(t, db, cnr, fs, object.AddressOf(raw1))
|
||||||
})
|
})
|
||||||
|
@ -646,32 +647,32 @@ func TestDB_SelectSplitID(t *testing.T) {
|
||||||
|
|
||||||
t.Run("not present", func(t *testing.T) {
|
t.Run("not present", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderSplitID, "", objectSDK.MatchNotPresent)
|
fs.AddFilter(objectapi.FilterHeaderSplitID, "", objectSDK.MatchNotPresent)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("split id", func(t *testing.T) {
|
t.Run("split id", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderSplitID, split1.String(), objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderSplitID, split1.String(), objectSDK.MatchStringEqual)
|
||||||
testSelect(t, db, cnr, fs,
|
testSelect(t, db, cnr, fs,
|
||||||
object.AddressOf(child1),
|
object.AddressOf(child1),
|
||||||
object.AddressOf(child2),
|
object.AddressOf(child2),
|
||||||
)
|
)
|
||||||
|
|
||||||
fs = objectSDK.SearchFilters{}
|
fs = objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderSplitID, split2.String(), objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderSplitID, split2.String(), objectSDK.MatchStringEqual)
|
||||||
testSelect(t, db, cnr, fs, object.AddressOf(child3))
|
testSelect(t, db, cnr, fs, object.AddressOf(child3))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("empty split", func(t *testing.T) {
|
t.Run("empty split", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderSplitID, "", objectSDK.MatchStringEqual)
|
fs.AddFilter(objectapi.FilterHeaderSplitID, "", objectSDK.MatchStringEqual)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("unknown split id", func(t *testing.T) {
|
t.Run("unknown split id", func(t *testing.T) {
|
||||||
fs := objectSDK.SearchFilters{}
|
fs := objectSDK.SearchFilters{}
|
||||||
fs.AddFilter(v2object.FilterHeaderSplitID,
|
fs.AddFilter(objectapi.FilterHeaderSplitID,
|
||||||
objectSDK.NewSplitID().String(),
|
objectSDK.NewSplitID().String(),
|
||||||
objectSDK.MatchStringEqual)
|
objectSDK.MatchStringEqual)
|
||||||
testSelect(t, db, cnr, fs)
|
testSelect(t, db, cnr, fs)
|
||||||
|
@ -732,7 +733,7 @@ func BenchmarkSelect(b *testing.B) {
|
||||||
cid := cidtest.ID()
|
cid := cidtest.ID()
|
||||||
|
|
||||||
for i := 0; i < objCount; i++ {
|
for i := 0; i < objCount; i++ {
|
||||||
var attr objectSDK.Attribute
|
attr := *objectSDK.NewAttribute()
|
||||||
attr.SetKey("myHeader")
|
attr.SetKey("myHeader")
|
||||||
attr.SetValue(strconv.Itoa(i))
|
attr.SetValue(strconv.Itoa(i))
|
||||||
obj := testutil.GenerateObjectWithCID(cid)
|
obj := testutil.GenerateObjectWithCID(cid)
|
||||||
|
|
|
@ -214,7 +214,7 @@ func (s *Shard) refillMetabase(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Shard) refillLockObject(ctx context.Context, obj *objectSDK.Object) error {
|
func (s *Shard) refillLockObject(ctx context.Context, obj *objectSDK.Object) error {
|
||||||
var lock objectSDK.Lock
|
lock := *objectSDK.NewLock()
|
||||||
if err := lock.Unmarshal(obj.Payload()); err != nil {
|
if err := lock.Unmarshal(obj.Payload()); err != nil {
|
||||||
return fmt.Errorf("could not unmarshal lock content: %w", err)
|
return fmt.Errorf("could not unmarshal lock content: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ func TestRefillMetabase(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// LOCK object handling
|
// LOCK object handling
|
||||||
var lock objectSDK.Lock
|
lock := *objectSDK.NewLock()
|
||||||
lock.WriteMembers(locked)
|
lock.WriteMembers(locked)
|
||||||
|
|
||||||
lockObj := objecttest.Object()
|
lockObj := objecttest.Object()
|
||||||
|
@ -295,7 +295,7 @@ func TestRefillMetabase(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, expObj.CutPayload(), res.Object())
|
require.True(t, expObj.CutPayload().Equal(res.Object()))
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAllObjs := func(exists bool) {
|
checkAllObjs := func(exists bool) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ func Test_GCDropsLockedExpiredSimpleObject(t *testing.T) {
|
||||||
|
|
||||||
cnr := cidtest.ID()
|
cnr := cidtest.ID()
|
||||||
|
|
||||||
var objExpirationAttr objectSDK.Attribute
|
objExpirationAttr := *objectSDK.NewAttribute()
|
||||||
objExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
objExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
objExpirationAttr.SetValue("101")
|
objExpirationAttr.SetValue("101")
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ func Test_GCDropsLockedExpiredSimpleObject(t *testing.T) {
|
||||||
obj.SetAttributes(objExpirationAttr)
|
obj.SetAttributes(objExpirationAttr)
|
||||||
objID, _ := obj.ID()
|
objID, _ := obj.ID()
|
||||||
|
|
||||||
var lockExpirationAttr objectSDK.Attribute
|
lockExpirationAttr := *objectSDK.NewAttribute()
|
||||||
lockExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
lockExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
lockExpirationAttr.SetValue("103")
|
lockExpirationAttr.SetValue("103")
|
||||||
|
|
||||||
|
@ -85,11 +85,11 @@ func Test_GCDropsLockedExpiredComplexObject(t *testing.T) {
|
||||||
parentID := oidtest.ID()
|
parentID := oidtest.ID()
|
||||||
splitID := objectSDK.NewSplitID()
|
splitID := objectSDK.NewSplitID()
|
||||||
|
|
||||||
var objExpirationAttr objectSDK.Attribute
|
objExpirationAttr := *objectSDK.NewAttribute()
|
||||||
objExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
objExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
objExpirationAttr.SetValue("101")
|
objExpirationAttr.SetValue("101")
|
||||||
|
|
||||||
var lockExpirationAttr objectSDK.Attribute
|
lockExpirationAttr := *objectSDK.NewAttribute()
|
||||||
lockExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
lockExpirationAttr.SetKey(objectV2.SysAttributeExpEpoch)
|
||||||
lockExpirationAttr.SetValue("103")
|
lockExpirationAttr.SetValue("103")
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ func (s *Shard) fetchObjectData(ctx context.Context, addr oid.Address, skipMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
if !mRes.Exists() {
|
if !mRes.Exists() {
|
||||||
return nil, false, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return nil, false, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s.log.Warn(logs.ShardFetchingObjectWithoutMeta, zap.Stringer("addr", addr))
|
s.log.Warn(logs.ShardFetchingObjectWithoutMeta, zap.Stringer("addr", addr))
|
||||||
|
|
|
@ -51,7 +51,7 @@ func testShardGet(t *testing.T, hasWriteCache bool) {
|
||||||
|
|
||||||
res, err := testGet(t, sh, getPrm, hasWriteCache)
|
res, err := testGet(t, sh, getPrm, hasWriteCache)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, obj, res.Object())
|
require.True(t, obj.Equal(res.Object()))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("big object", func(t *testing.T) {
|
t.Run("big object", func(t *testing.T) {
|
||||||
|
@ -69,7 +69,7 @@ func testShardGet(t *testing.T, hasWriteCache bool) {
|
||||||
|
|
||||||
res, err := testGet(t, sh, getPrm, hasWriteCache)
|
res, err := testGet(t, sh, getPrm, hasWriteCache)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, obj, res.Object())
|
require.True(t, obj.Equal(res.Object()))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("parent object", func(t *testing.T) {
|
t.Run("parent object", func(t *testing.T) {
|
||||||
|
|
|
@ -94,6 +94,7 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) {
|
||||||
cb := func(stor *blobstor.BlobStor, id []byte) (*objectSDK.Object, error) {
|
cb := func(stor *blobstor.BlobStor, id []byte) (*objectSDK.Object, error) {
|
||||||
var getRngPrm common.GetRangePrm
|
var getRngPrm common.GetRangePrm
|
||||||
getRngPrm.Address = prm.addr
|
getRngPrm.Address = prm.addr
|
||||||
|
getRngPrm.Range = *objectSDK.NewRange()
|
||||||
getRngPrm.Range.SetOffset(prm.off)
|
getRngPrm.Range.SetOffset(prm.off)
|
||||||
getRngPrm.Range.SetLength(prm.ln)
|
getRngPrm.Range.SetLength(prm.ln)
|
||||||
getRngPrm.StorageID = id
|
getRngPrm.StorageID = id
|
||||||
|
@ -119,7 +120,7 @@ func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error) {
|
||||||
from := prm.off
|
from := prm.off
|
||||||
to := from + prm.ln
|
to := from + prm.ln
|
||||||
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
if pLen := uint64(len(payload)); to < from || pLen < from || pLen < to {
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectOutOfRange{})
|
return nil, logicerr.Wrap(apistatus.NewObjectOutOfRange())
|
||||||
}
|
}
|
||||||
|
|
||||||
obj := objectSDK.New()
|
obj := objectSDK.New()
|
||||||
|
|
|
@ -150,7 +150,7 @@ func newObject() *objectSDK.Object {
|
||||||
x.SetOwnerID(usertest.ID())
|
x.SetOwnerID(usertest.ID())
|
||||||
x.SetContainerID(cidtest.ID())
|
x.SetContainerID(cidtest.ID())
|
||||||
x.SetType(objectSDK.TypeRegular)
|
x.SetType(objectSDK.TypeRegular)
|
||||||
x.SetVersion(&ver)
|
x.SetVersion(ver)
|
||||||
x.SetPayloadChecksum(checksumtest.Checksum())
|
x.SetPayloadChecksum(checksumtest.Checksum())
|
||||||
x.SetPayloadHomomorphicHash(checksumtest.Checksum())
|
x.SetPayloadHomomorphicHash(checksumtest.Checksum())
|
||||||
return x
|
return x
|
||||||
|
|
|
@ -201,7 +201,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj objectSDK.Object
|
obj := objectSDK.New()
|
||||||
err = obj.Unmarshal(data)
|
err = obj.Unmarshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.reportFlushError("can't unmarshal an object", sAddr, metaerr.Wrap(err))
|
c.reportFlushError("can't unmarshal an object", sAddr, metaerr.Wrap(err))
|
||||||
|
@ -211,7 +211,7 @@ func (c *cache) flushFSTree(ctx context.Context, ignoreErrors bool) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.flushObject(ctx, &obj, data, StorageTypeFSTree)
|
err = c.flushObject(ctx, obj, data, StorageTypeFSTree)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if ignoreErrors {
|
if ignoreErrors {
|
||||||
return nil
|
return nil
|
||||||
|
@ -322,7 +322,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj objectSDK.Object
|
obj := objectSDK.New()
|
||||||
if err := obj.Unmarshal(data); err != nil {
|
if err := obj.Unmarshal(data); err != nil {
|
||||||
c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err))
|
c.reportFlushError("can't unmarshal an object from the DB", sa, metaerr.Wrap(err))
|
||||||
if ignoreErrors {
|
if ignoreErrors {
|
||||||
|
@ -331,7 +331,7 @@ func (c *cache) flush(ctx context.Context, ignoreErrors bool) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.flushObject(ctx, &obj, data, StorageTypeDB); err != nil {
|
if err := c.flushObject(ctx, obj, data, StorageTypeDB); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ func TestFlush(t *testing.T) {
|
||||||
|
|
||||||
res, err := bs.Get(context.Background(), prm)
|
res, err := bs.Get(context.Background(), prm)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, objects[i].obj, res.Object)
|
require.True(t, objects[i].obj.Equal(res.Object))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ func newObject(t *testing.T, size int) (*objectSDK.Object, []byte) {
|
||||||
obj.SetOwnerID(usertest.ID())
|
obj.SetOwnerID(usertest.ID())
|
||||||
obj.SetContainerID(cidtest.ID())
|
obj.SetContainerID(cidtest.ID())
|
||||||
obj.SetType(objectSDK.TypeRegular)
|
obj.SetType(objectSDK.TypeRegular)
|
||||||
obj.SetVersion(&ver)
|
obj.SetVersion(ver)
|
||||||
obj.SetPayloadChecksum(checksumtest.Checksum())
|
obj.SetPayloadChecksum(checksumtest.Checksum())
|
||||||
obj.SetPayloadHomomorphicHash(checksumtest.Checksum())
|
obj.SetPayloadHomomorphicHash(checksumtest.Checksum())
|
||||||
obj.SetPayload(make([]byte, size))
|
obj.SetPayload(make([]byte, size))
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (c *cache) getInternal(ctx context.Context, saddr string, addr oid.Address)
|
||||||
|
|
||||||
res, err := c.fsTree.Get(ctx, common.GetPrm{Address: addr})
|
res, err := c.fsTree.Get(ctx, common.GetPrm{Address: addr})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, logicerr.Wrap(apistatus.ObjectNotFound{})
|
return nil, logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
|
|
||||||
found = true
|
found = true
|
||||||
|
@ -92,7 +92,7 @@ func Get(db *bbolt.DB, key []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
value = b.Get(key)
|
value = b.Get(key)
|
||||||
if value == nil {
|
if value == nil {
|
||||||
return logicerr.Wrap(apistatus.ObjectNotFound{})
|
return logicerr.Wrap(apistatus.NewObjectNotFound())
|
||||||
}
|
}
|
||||||
value = slice.Copy(value)
|
value = slice.Copy(value)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||||
|
@ -55,7 +55,7 @@ func (c *Client) GetEACL(cnr cid.ID) (*container.EACL, error) {
|
||||||
// The absence of a signature in the response can be taken as an eACL absence criterion,
|
// The absence of a signature in the response can be taken as an eACL absence criterion,
|
||||||
// since unsigned table cannot be approved in the storage by design.
|
// since unsigned table cannot be approved in the storage by design.
|
||||||
if len(sig) == 0 {
|
if len(sig) == 0 {
|
||||||
var errEACLNotFound apistatus.EACLNotFound
|
errEACLNotFound := apistatus.NewEACLNotFound()
|
||||||
|
|
||||||
return nil, errEACLNotFound
|
return nil, errEACLNotFound
|
||||||
}
|
}
|
||||||
|
@ -86,12 +86,12 @@ func (c *Client) GetEACL(cnr cid.ID) (*container.EACL, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
|
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsGRPC.Signature
|
||||||
sigV2.SetKey(pub)
|
sigV2.SetKey(pub)
|
||||||
sigV2.SetSign(sig)
|
sigV2.SetSign(sig)
|
||||||
sigV2.SetScheme(refs.ECDSA_RFC6979_SHA256)
|
sigV2.SetScheme(refsGRPC.SignatureScheme_ECDSA_RFC6979_SHA256)
|
||||||
|
|
||||||
err = res.Signature.ReadFromV2(sigV2)
|
err = res.Signature.ReadFromV2(&sigV2)
|
||||||
return &res, err
|
return &res, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package container
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
)
|
)
|
||||||
|
@ -31,8 +31,8 @@ func PutEACL(c *Client, eaclInfo containercore.EACL) error {
|
||||||
prm.SetToken(eaclInfo.Session.Marshal())
|
prm.SetToken(eaclInfo.Session.Marshal())
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
|
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsGRPC.Signature
|
||||||
eaclInfo.Signature.WriteToV2(&sigV2)
|
eaclInfo.Signature.WriteToV2(&sigV2)
|
||||||
|
|
||||||
prm.SetKey(sigV2.GetKey())
|
prm.SetKey(sigV2.GetKey())
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
containerContract "git.frostfs.info/TrueCloudLab/frostfs-contract/container"
|
containerContract "git.frostfs.info/TrueCloudLab/frostfs-contract/container"
|
||||||
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
|
@ -51,7 +51,7 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
|
||||||
res, err := c.client.TestInvoke(prm)
|
res, err := c.client.TestInvoke(prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), containerContract.NotFoundError) {
|
if strings.Contains(err.Error(), containerContract.NotFoundError) {
|
||||||
var errNotFound apistatus.ContainerNotFound
|
errNotFound := apistatus.NewContainerNotFound()
|
||||||
|
|
||||||
return nil, errNotFound
|
return nil, errNotFound
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,12 @@ func (c *Client) Get(cid []byte) (*containercore.Container, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
|
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsGRPC.Signature
|
||||||
sigV2.SetKey(pub)
|
sigV2.SetKey(pub)
|
||||||
sigV2.SetSign(sigBytes)
|
sigV2.SetSign(sigBytes)
|
||||||
sigV2.SetScheme(refs.ECDSA_RFC6979_SHA256)
|
sigV2.SetScheme(refsGRPC.SignatureScheme_ECDSA_RFC6979_SHA256)
|
||||||
|
|
||||||
err = cnr.Signature.ReadFromV2(sigV2)
|
err = cnr.Signature.ReadFromV2(&sigV2)
|
||||||
return &cnr, err
|
return &cnr, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
v2refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
v2refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
|
|
|
@ -3,7 +3,7 @@ package container
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
refsGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||||
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
|
@ -28,8 +28,8 @@ func Put(c *Client, cnr containercore.Container) (*cid.ID, error) {
|
||||||
prm.SetToken(cnr.Session.Marshal())
|
prm.SetToken(cnr.Session.Marshal())
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(@cthulhu-rider): #468 implement and use another approach to avoid conversion
|
// TODO(@cthulhu-rider): #1387 implement and use another approach to avoid conversion
|
||||||
var sigV2 refs.Signature
|
var sigV2 refsGRPC.Signature
|
||||||
cnr.Signature.WriteToV2(&sigV2)
|
cnr.Signature.WriteToV2(&sigV2)
|
||||||
|
|
||||||
prm.SetKey(sigV2.GetKey())
|
prm.SetKey(sigV2.GetKey())
|
||||||
|
|
|
@ -11,6 +11,10 @@ import (
|
||||||
|
|
||||||
type NodeInfo = netmap.NodeInfo
|
type NodeInfo = netmap.NodeInfo
|
||||||
|
|
||||||
|
func NewNodeInfo() NodeInfo {
|
||||||
|
return NodeInfo(netmap.NewNodeInfo())
|
||||||
|
}
|
||||||
|
|
||||||
// Client is a wrapper over StaticClient
|
// Client is a wrapper over StaticClient
|
||||||
// which makes calls with the names and arguments
|
// which makes calls with the names and arguments
|
||||||
// of the FrostFS Netmap contract.
|
// of the FrostFS Netmap contract.
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
func Test_stackItemsToNodeInfos(t *testing.T) {
|
func Test_stackItemsToNodeInfos(t *testing.T) {
|
||||||
expected := make([]netmap.NodeInfo, 4)
|
expected := make([]netmap.NodeInfo, 4)
|
||||||
for i := range expected {
|
for i := range expected {
|
||||||
|
expected[i] = netmap.NewNodeInfo()
|
||||||
pub := make([]byte, 33)
|
pub := make([]byte, 33)
|
||||||
rand.Read(pub)
|
rand.Read(pub)
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue