forked from TrueCloudLab/frostfs-api-go
84daaf59ef
``` ObjectIDSlice/0_elements/to_grpc_message-8 5.64ns ± 2% 5.89ns ± 4% +4.56% (p=0.000 n=10+10) ObjectIDSlice/0_elements/from_grpc_message-8 6.68ns ± 3% 6.81ns ± 8% ~ (p=0.143 n=10+10) ObjectIDSlice/0_elements/marshal-8 7.41ns ± 3% 7.91ns ± 4% +6.63% (p=0.000 n=10+10) ObjectIDSlice/1_elements/to_grpc_message-8 69.8ns ± 3% 80.5ns ± 7% +15.39% (p=0.000 n=10+10) ObjectIDSlice/1_elements/from_grpc_message-8 56.4ns ± 6% 34.7ns ± 5% -38.55% (p=0.000 n=10+9) ObjectIDSlice/1_elements/marshal-8 68.4ns ± 4% 67.6ns ± 4% ~ (p=0.404 n=10+10) ObjectIDSlice/50_elements/to_grpc_message-8 2.52µs ± 7% 2.56µs ± 4% ~ (p=0.315 n=10+9) ObjectIDSlice/50_elements/from_grpc_message-8 1.83µs ± 8% 0.44µs ± 1% -75.73% (p=0.000 n=10+8) ObjectIDSlice/50_elements/marshal-8 2.32µs ±17% 2.22µs ± 3% ~ (p=0.247 n=10+10) name old alloc/op new alloc/op delta ObjectIDSlice/0_elements/to_grpc_message-8 0.00B 0.00B ~ (all equal) ObjectIDSlice/0_elements/from_grpc_message-8 0.00B 0.00B ~ (all equal) ObjectIDSlice/0_elements/marshal-8 0.00B 0.00B ~ (all equal) ObjectIDSlice/1_elements/to_grpc_message-8 72.0B ± 0% 72.0B ± 0% ~ (all equal) ObjectIDSlice/1_elements/from_grpc_message-8 32.0B ± 0% 24.0B ± 0% -25.00% (p=0.000 n=10+10) ObjectIDSlice/1_elements/marshal-8 48.0B ± 0% 48.0B ± 0% ~ (all equal) ObjectIDSlice/50_elements/to_grpc_message-8 3.62kB ± 0% 3.62kB ± 0% ~ (all equal) ObjectIDSlice/50_elements/from_grpc_message-8 1.62kB ± 0% 1.28kB ± 0% -20.79% (p=0.000 n=10+10) ObjectIDSlice/50_elements/marshal-8 2.05kB ± 0% 2.05kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta ObjectIDSlice/0_elements/to_grpc_message-8 0.00 0.00 ~ (all equal) ObjectIDSlice/0_elements/from_grpc_message-8 0.00 0.00 ~ (all equal) ObjectIDSlice/0_elements/marshal-8 0.00 0.00 ~ (all equal) ObjectIDSlice/1_elements/to_grpc_message-8 2.00 ± 0% 2.00 ± 0% ~ (all equal) ObjectIDSlice/1_elements/from_grpc_message-8 2.00 ± 0% 1.00 ± 0% -50.00% (p=0.000 n=10+10) ObjectIDSlice/1_elements/marshal-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) ObjectIDSlice/50_elements/to_grpc_message-8 51.0 ± 0% 51.0 ± 0% ~ (all equal) ObjectIDSlice/50_elements/from_grpc_message-8 51.0 ± 0% 1.0 ± 0% -98.04% (p=0.000 n=10+10) ObjectIDSlice/50_elements/marshal-8 1.00 ± 0% 1.00 ± 0% ~ (all equal) ``` Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
118 lines
1.7 KiB
Go
118 lines
1.7 KiB
Go
package refstest
|
|
|
|
import (
|
|
"math/rand"
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
|
)
|
|
|
|
func GenerateVersion(empty bool) *refs.Version {
|
|
m := new(refs.Version)
|
|
|
|
if !empty {
|
|
m.SetMajor(2)
|
|
m.SetMinor(1)
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateOwnerID(empty bool) *refs.OwnerID {
|
|
m := new(refs.OwnerID)
|
|
|
|
if !empty {
|
|
m.SetValue([]byte{1, 2, 3})
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateAddress(empty bool) *refs.Address {
|
|
m := new(refs.Address)
|
|
|
|
if !empty {
|
|
m.SetObjectID(GenerateObjectID(false))
|
|
m.SetContainerID(GenerateContainerID(false))
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateObjectID(empty bool) *refs.ObjectID {
|
|
m := new(refs.ObjectID)
|
|
|
|
if !empty {
|
|
m.SetValue([]byte{1, 2, 3})
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateObjectIDs(empty bool) []refs.ObjectID {
|
|
var ids []refs.ObjectID
|
|
|
|
if !empty {
|
|
ids = append(ids,
|
|
*GenerateObjectID(false),
|
|
*GenerateObjectID(false),
|
|
)
|
|
}
|
|
|
|
return ids
|
|
}
|
|
|
|
func GenerateContainerID(empty bool) *refs.ContainerID {
|
|
m := new(refs.ContainerID)
|
|
|
|
if !empty {
|
|
m.SetValue([]byte{1, 2, 3})
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateContainerIDs(empty bool) []*refs.ContainerID {
|
|
var res []*refs.ContainerID
|
|
|
|
if !empty {
|
|
res = append(res,
|
|
GenerateContainerID(false),
|
|
GenerateContainerID(false),
|
|
)
|
|
}
|
|
|
|
return res
|
|
}
|
|
|
|
func GenerateSignature(empty bool) *refs.Signature {
|
|
m := new(refs.Signature)
|
|
|
|
if !empty {
|
|
m.SetKey([]byte{1})
|
|
m.SetSign([]byte{2})
|
|
m.SetScheme(refs.SignatureScheme(rand.Int31() % 3))
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateChecksum(empty bool) *refs.Checksum {
|
|
m := new(refs.Checksum)
|
|
|
|
if !empty {
|
|
m.SetType(1)
|
|
m.SetSum([]byte{1, 2, 3})
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateSubnetID(empty bool) *refs.SubnetID {
|
|
m := new(refs.SubnetID)
|
|
|
|
if !empty {
|
|
m.SetValue(666)
|
|
}
|
|
|
|
return m
|
|
}
|