shard

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 6 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ShardList = generateShardList()

ShardList is the list of shard index.

Functions

func GetShardIDByPublicHash

func GetShardIDByPublicHash(pkHash *multivacaddress.PublicKeyHash) uint32

GetShardIDByPublicHash function has been deprecated, so don't use it in the future.

func IndexToID

func IndexToID(index Index) uint32

IndexToID transfers a Index back to id.

func IndexToString

func IndexToString(index Index) string

IndexToString convert the shard index to string type.

func IsValidShardID

func IsValidShardID(id uint32) bool

IsValidShardID returns whether or not the id is within the valid shard id range.

Types

type Index

type Index uint32

Index is the index of shard.

func GetShardIndexByPublicHash

func GetShardIndexByPublicHash(pkHash *multivacaddress.PublicKeyHash) Index

GetShardIndexByPublicHash function has been deprecated, so don't use it in the future.

func IDToShardIndex

func IDToShardIndex(id uint32) Index

IDToShardIndex returns a MultiVAC Index format from a given number in the supported shard range.

func (Index) GetID

func (s Index) GetID() uint32

GetID returns the shard index.

func (Index) MarshalJSON

func (s Index) MarshalJSON() ([]byte, error)

MarshalJSON serialization the data to byte slice and then keep it to json.

func (Index) String

func (s Index) String() string

String returns the format string like:Id:shardID.

func (*Index) UnmarshalJSON

func (s *Index) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialization the json data to origin data.

type IndexAndHeight

type IndexAndHeight struct {
	Index  Index
	Height int64
}

IndexAndHeight combines the index and height.

func NewShardIndexAndHeight

func NewShardIndexAndHeight(shard Index, hgt int64) IndexAndHeight

NewShardIndexAndHeight returns a IndexAndHeight.

func (IndexAndHeight) String

func (s IndexAndHeight) String() string

String returns the format string for IndexAndHeight.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL