Documentation ¶
Overview ¶
Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector
Copyright (c) 2017-2018 The qitmeer developers
Index ¶
- func AppDataDir(appName string, roaming bool) string
- func CleanAndExpandPath(path string) string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func FileExists(name string) bool
- func FromHex(hex string) *big.Int
- func HasHexPrefix(str string) bool
- func LeftPadBytes(slice []byte, l int) []byte
- func MustDecodeHexString(hexStr string) []byte
- func MustHex2Bytes(str string) []byte
- func PaddedAppend(size uint, dst, src []byte) []byte
- func PaddedBytes(size uint, n *big.Int) []byte
- func ReadSizedRand(rand io.Reader, size uint) []byte
- func ReverseBytes(b []byte)
- func RightPadBytes(slice []byte, l int) []byte
- type BitVector
- type IterativeQueue
- type TimeSorter
- type WaitGroupWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppDataDir ¶
AppDataDir returns an operating system specific directory to be used for storing application data for an application.
The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice. An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.
The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default.
Example results:
dir := AppDataDir("myapp", false) POSIX (Linux/BSD): ~/.myapp Mac OS: $HOME/Library/Application Support/Myapp Windows: %LOCALAPPDATA%\Myapp Plan 9: $home/myapp
func CleanAndExpandPath ¶
CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it.
func FileExists ¶
FilesExists reports whether the named file or directory exists.
func HasHexPrefix ¶
func LeftPadBytes ¶
func MustDecodeHexString ¶
MustDecodeHex wrap the calling to hex.DecodeString() method to return the bytes represented by the hexadecimal string. It panics if an error occurs. This is useful in the tests or some special cases.
func MustHex2Bytes ¶
MustHex2Bytes returns the bytes represented by the hexadecimal string str. Must means panic when err
func PaddedAppend ¶
PaddedAppend appends the src byte slice to dst, returning the new slice. If the length of the source is smaller than the passed size, leading zero bytes are appended to the dst slice before appending src. Example : Bitcoin uncompressed pubkey
uncompressed := make([]byte, 0, 65) uncompressed = append(uncompressed, 0x01) uncompressed = PaddedAppend(32, uncompressed, p.X.Bytes()) uncompressed = PaddedAppend(32, uncompressed, p.Y.Bytes())
func PaddedBytes ¶
PaddedBytes encodes a big integer as a big-endian byte slice, if the length of byte slice is smaller than the passed size, leading zero bytes will be added. Example : Ethereum privatekey
seckey := PaddedBigInt(32, prv.D)
Ethereum pubkey
func ReadSizedRand ¶
ReadRand read size bytes from input rand if input rand is nil, use crypto/rand
func ReverseBytes ¶
func ReverseBytes(b []byte)
func RightPadBytes ¶
Types ¶
type BitVector ¶
type BitVector struct {
// contains filtered or unexported fields
}
BitVector this is design for cuckoo hash bytes
func NewFromBytes ¶
convert from bytes
type IterativeQueue ¶
type IterativeQueue []interface{}
func NewIterativeQueue ¶
func NewIterativeQueue() IterativeQueue
func (*IterativeQueue) Dequeue ¶
func (iq *IterativeQueue) Dequeue() interface{}
func (*IterativeQueue) Enqueue ¶
func (iq *IterativeQueue) Enqueue(item interface{})
func (*IterativeQueue) Len ¶
func (iq *IterativeQueue) Len() int
func (*IterativeQueue) Peek ¶
func (iq *IterativeQueue) Peek() interface{}
type TimeSorter ¶
type TimeSorter []int64
timeSorter implements sort.Interface to allow a slice of timestamps to be sorted.
func (TimeSorter) Len ¶
func (s TimeSorter) Len() int
Len returns the number of timestamps in the slice. It is part of the sort.Interface implementation.
func (TimeSorter) Less ¶
func (s TimeSorter) Less(i, j int) bool
Less returns whether the timstamp with index i should sort before the timestamp with index j. It is part of the sort.Interface implementation.
func (TimeSorter) Swap ¶
func (s TimeSorter) Swap(i, j int)
Swap swaps the timestamps at the passed indices. It is part of the sort.Interface implementation.
type WaitGroupWrapper ¶
func (*WaitGroupWrapper) Wrap ¶
func (w *WaitGroupWrapper) Wrap(cb func())