Documentation ¶
Index ¶
- Variables
- func BlsAggregate(secondarySigs [][]byte) ([]byte, error)
- func BoolToInt(b bool) int
- func BytesSliceToString(bytes [][]byte) string
- func ContainOnlyOneDifferentElement(slice1, slice2 []uint32) int
- func GenerateRequestID() string
- func GetBucketPrimarySPID(ctx context.Context, chainClient consensus.Consensus, ...) (uint32, error)
- func GetIPFromGRPCContext(ctx context.Context) net.IP
- func GetRandomBucketName() string
- func GetRandomGroupName() string
- func GetRandomObjectName() string
- func GetSecondarySPIndexFromGVG(gvg *virtualgrouptypes.GlobalVirtualGroup, spID uint32) (int32, error)
- func JoinWithComma(slice []string) string
- func RandHexKey() string
- func RandInt64(min, max int64) int64
- func RandomNum(n, scope int) int
- func RandomString(n int) string
- func RandomStringToLower(n int) string
- func RandomStringToUpper(n int) string
- func SplitByComma(str string) []string
- func StringArrayToUint32Slice(arr pq.StringArray) ([]uint32, error)
- func StringToBool(str string) (bool, error)
- func StringToBytesSlice(str string) ([][]byte, error)
- func StringToInt32(str string) (int32, error)
- func StringToInt64(str string) (int64, error)
- func StringToUint32(str string) (uint32, error)
- func StringToUint32Slice(str string) ([]uint32, error)
- func StringToUint64(str string) (uint64, error)
- func TotalStakingStoreSizeOfGVG(gvg *virtualgrouptypes.GlobalVirtualGroup, stakingPerBytes sdkmath.Int) uint64
- func Uint32SliceToString(ids []uint32) string
- func Uint32ToString(u uint32) string
- func Uint64ToString(u uint64) string
- func ValidateAndGetSPIndexWithinGVGSecondarySPs(ctx context.Context, client *gfspclient.GfSpClient, selfSpID uint32, ...) (int, bool, error)
- func ValidatePrimarySP(selfSpID, primarySpID uint32) bool
- func ValidateSecondarySPs(selfSpID uint32, secondarySpIDs []uint32) (int, bool)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIntegerOverflow defines integer overflow ErrIntegerOverflow = errors.New("integer overflow") )
var ( // ErrNotInSecondarySPs define the specified sp does not exist error. ErrNotInSecondarySPs = errors.New("target sp is not in the gvg secondary sp list") )
Functions ¶
func BlsAggregate ¶ added in v0.2.3
BlsAggregate aggregate secondary sp bls signature
func BytesSliceToString ¶
BytesSliceToString is used to serialize
func ContainOnlyOneDifferentElement ¶ added in v0.2.3
ContainOnlyOneDifferentElement check two slices if they have the same length, order and one different element
func GenerateRequestID ¶
func GenerateRequestID() string
GenerateRequestID is used to generate random requestID.
func GetBucketPrimarySPID ¶ added in v0.2.3
func GetBucketPrimarySPID(ctx context.Context, chainClient consensus.Consensus, bucketInfo *storagetypes.BucketInfo) (uint32, error)
func GetIPFromGRPCContext ¶
GetIPFromGRPCContext returns a IP from grpc client
func GetRandomBucketName ¶ added in v0.2.2
func GetRandomBucketName() string
GetRandomBucketName generate random bucket name.
func GetRandomGroupName ¶ added in v0.2.2
func GetRandomGroupName() string
GetRandomGroupName generate random group name.
func GetRandomObjectName ¶ added in v0.2.2
func GetRandomObjectName() string
GetRandomObjectName generate random object name.
func GetSecondarySPIndexFromGVG ¶ added in v0.2.3
func GetSecondarySPIndexFromGVG(gvg *virtualgrouptypes.GlobalVirtualGroup, spID uint32) (int32, error)
GetSecondarySPIndexFromGVG returns secondary sp index in the secondary sp list.
func JoinWithComma ¶
JoinWithComma converts string slice to one string with comma
func RandHexKey ¶ added in v0.2.2
func RandHexKey() string
func RandomString ¶ added in v0.2.2
func RandomStringToLower ¶ added in v0.2.2
func RandomStringToUpper ¶ added in v0.2.2
func StringArrayToUint32Slice ¶ added in v0.2.3
func StringArrayToUint32Slice(arr pq.StringArray) ([]uint32, error)
func StringToBytesSlice ¶
StringToBytesSlice is used to deserialize
func StringToInt32 ¶
StringToInt32 converts string to int32
func StringToInt64 ¶
StringToInt64 converts string to int64
func StringToUint32 ¶
StringToUint32 coverts string to uint32
func StringToUint32Slice ¶ added in v0.2.3
func StringToUint64 ¶
StringToUint64 converts string to uint64
func TotalStakingStoreSizeOfGVG ¶ added in v0.2.3
func TotalStakingStoreSizeOfGVG(gvg *virtualgrouptypes.GlobalVirtualGroup, stakingPerBytes sdkmath.Int) uint64
TotalStakingStoreSizeOfGVG calculates the global virtual group total staking storage size
func Uint32SliceToString ¶ added in v0.2.3
func ValidateAndGetSPIndexWithinGVGSecondarySPs ¶ added in v0.2.3
func ValidateAndGetSPIndexWithinGVGSecondarySPs(ctx context.Context, client *gfspclient.GfSpClient, selfSpID uint32, bucketID uint64, lvgID uint32) (int, bool, error)
ValidateAndGetSPIndexWithinGVGSecondarySPs return whether current sp is one of the object gvg's secondary sp and its index within GVG(if is)
func ValidatePrimarySP ¶ added in v0.2.3
ValidatePrimarySP returns whether selfSpID is primarySpID
Types ¶
This section is empty.