Documentation ¶
Index ¶
- func BigTo256(b *big.Int) common.Hash
- func CheckPid(pidfileName string) error
- func FreePort(network string) (port uint16)
- func GetUnusedNetAddr(n int, t testing.TB) []string
- func H256toU64(h common.Hash) uint64
- func HashFromHex(s string) []byte
- func I64to256(i64 int64) common.Hash
- func NameOf(p idx.StakerID) string
- func PaddedBigBytes(bigint *big.Int, n int) []byte
- func ReadBits(bigint *big.Int, buf []byte)
- func TextColumns(texts ...string) string
- func ToFtm(ftm uint64) *big.Int
- func U64to256(u64 uint64) common.Hash
- func WeightedPermutation(size int, weights []pos.Stake, seed common.Hash) []int
- type AvgBuff
- type BitArray
- type BitArrayReader
- type BitArrayWriter
- type SpinLock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUnusedNetAddr ¶
GetUnusedNetAddr return array of n unused ports starting with base port NB: addresses 1-1024 are reserved for non-root users;
func PaddedBigBytes ¶
PaddedBigBytes encodes a big integer as a big-endian byte slice. The length of the slice is at least n bytes.
Types ¶
type BitArray ¶
type BitArray struct {
// contains filtered or unexported fields
}
BitArray stores only first <bits> of each of <count> numbers.
func NewBitArray ¶
NewBitArray makes bits array of int.
func (*BitArray) Reader ¶
func (a *BitArray) Reader(r []byte) *BitArrayReader
Reader is a number unpacker.
func (*BitArray) Writer ¶
func (a *BitArray) Writer(w []byte) *BitArrayWriter
Writer is a number packer.
type BitArrayReader ¶
type BitArrayReader struct { BitArray // contains filtered or unexported fields }
BitArrayReader of numbers from BitArray.
type BitArrayWriter ¶
type BitArrayWriter struct { BitArray // contains filtered or unexported fields }
BitArrayWriter of numbers to BitArray.
type SpinLock ¶
type SpinLock struct {
// contains filtered or unexported fields
}
SpinLock implements a simple atomic spin lock, the zero value for a SpinLock is an unlocked spinlock.
func (*SpinLock) Lock ¶
func (sl *SpinLock) Lock()
Lock locks sl. If the lock is already in use, the caller blocks until Unlock is called
func (*SpinLock) TryLock ¶
TryLock will try to lock sl and return whether it succeed or not without blocking.
func (*SpinLock) Unlock ¶
func (sl *SpinLock) Unlock()
Unlock unlocks sl, unlike [Mutex.Unlock](http://golang.org/pkg/sync/#Mutex.Unlock), there's no harm calling it on an unlocked SpinLock