Documentation
¶
Index ¶
- Constants
- Variables
- func BytesCopy(src []byte) []byte
- func BytesToNumber(ptr interface{}, b []byte)
- func BytesToUint64(d []byte) uint64
- func Clone(dst, src interface{}) error
- func CloneSlice(a [][]byte) [][]byte
- func CreateDomainID(seed string) string
- func DeepCopyByGob(dst, src interface{}) error
- func GenerateRandomNumber(start int, end int, count int) []int
- func Has0xPrefix(str string) bool
- func IsContainItem(target interface{}, array []interface{}) bool
- func IsContainString(target string, str_array []string) bool
- func IsHex(str string) bool
- func IsHexCharacter(c byte) bool
- func MinInt64(x, y int64) int64
- func MinUint64(x, y uint64) uint64
- func NewRandReader(seed string) (io.Reader, error)
- func NodeIDs(nodeM []*NodeDomainMember) []string
- func NumberToByte(number interface{}) []byte
- func RemoveIfExistString(target string, str_array []string) []string
- func SafeAddUint64(a, b uint64) (uint64, error)
- func SafeMul(a uint64, b uint64) *big.Int
- func SafeSubUint64(a, b uint64) (uint64, error)
- func Uint64ToBytes(v uint64) []byte
- type DomainType
- type EpochInfo
- type Hasher
- type IterCBFunc
- type LedgerState
- type NetworkType
- type NodeConsensusDomain
- type NodeDomainInfo
- type NodeDomainMember
- type NodeExecuteDomain
- type NodeInfo
- type NodeRole
- type NodeState
- type SeedRandReader
- type ShrinkableMap
- func (m *ShrinkableMap) AllKeys() []interface{}
- func (m *ShrinkableMap) Del(key interface{})
- func (m *ShrinkableMap) Get(key interface{}) (interface{}, bool)
- func (m *ShrinkableMap) IterateCallback(iterCBF IterCBFunc)
- func (m *ShrinkableMap) Set(key, value interface{})
- func (m *ShrinkableMap) Size() int
Constants ¶
View Source
const ( NodeRole_Unknown NodeRole = 0x00 NodeRole_Executor = 0x01 NodeRole_Proposer = 0x02 NodeRole_Validator = 0x04 NodeRole_Archiver = 0x08 )
View Source
const (
EpochSpan = 300
)
Variables ¶
View Source
var CurrentNetworkType = NetworkType_Testnet
Functions ¶
func BytesToNumber ¶
func BytesToNumber(ptr interface{}, b []byte)
func BytesToUint64 ¶
func CloneSlice ¶
func CreateDomainID ¶
func DeepCopyByGob ¶
func DeepCopyByGob(dst, src interface{}) error
func GenerateRandomNumber ¶
Generate count randon number in [start, end)
func Has0xPrefix ¶
func IsContainItem ¶
func IsContainItem(target interface{}, array []interface{}) bool
func IsContainString ¶
func IsHexCharacter ¶
func NodeIDs ¶
func NodeIDs(nodeM []*NodeDomainMember) []string
func NumberToByte ¶
func NumberToByte(number interface{}) []byte
func RemoveIfExistString ¶
func SafeAddUint64 ¶
func SafeSubUint64 ¶
func Uint64ToBytes ¶
Types ¶
type DomainType ¶
type DomainType byte
const ( DomainType_Unknown DomainType = iota DomainType_Execute DomainType_Consensus )
type Hasher ¶
type Hasher interface {
Compute(string) []byte
Size() int
Writer() io.Writer
Bytes() []byte
Reset()
}
func NewBlake2bHasher ¶
type IterCBFunc ¶
type IterCBFunc func(key interface{}, val interface{})
type LedgerState ¶
type LedgerState byte
const ( LedgerState_Uninitialized LedgerState = iota LedgerState_Genesis LedgerState_AutoInc )
type NetworkType ¶
type NetworkType byte
const ( NetworkType_Unknown NetworkType = iota NetworkType_Mainnet NetworkType_Testnet )
func (NetworkType) String ¶
func (n NetworkType) String() string
func (NetworkType) Value ¶
func (n NetworkType) Value(netType byte) NetworkType
type NodeConsensusDomain ¶
type NodeConsensusDomain struct {
Threshold int
NParticipant int
PublicKey []byte
Members []*NodeDomainMember
}
type NodeDomainInfo ¶
type NodeDomainInfo struct {
ID string
Type DomainType
ValidHeightStart uint64
ValidHeightEnd uint64
CSDomainData *NodeConsensusDomain
ExeDomainData *NodeExecuteDomain
}
type NodeDomainMember ¶
type NodeExecuteDomain ¶
type NodeExecuteDomain struct {
Members []string //nodeIDs
}
type SeedRandReader ¶
type SeedRandReader struct {
// contains filtered or unexported fields
}
func NewSeedRandReader ¶
func NewSeedRandReader(seed []byte) (*SeedRandReader, error)
type ShrinkableMap ¶
type ShrinkableMap struct {
// contains filtered or unexported fields
}
func NewShrinkMap ¶
func NewShrinkMap() *ShrinkableMap
func (*ShrinkableMap) AllKeys ¶
func (m *ShrinkableMap) AllKeys() []interface{}
func (*ShrinkableMap) Del ¶
func (m *ShrinkableMap) Del(key interface{})
func (*ShrinkableMap) Get ¶
func (m *ShrinkableMap) Get(key interface{}) (interface{}, bool)
func (*ShrinkableMap) IterateCallback ¶
func (m *ShrinkableMap) IterateCallback(iterCBF IterCBFunc)
func (*ShrinkableMap) Set ¶
func (m *ShrinkableMap) Set(key, value interface{})
func (*ShrinkableMap) Size ¶
func (m *ShrinkableMap) Size() int
Click to show internal directories.
Click to hide internal directories.