Documentation ¶
Overview ¶
Package common contains various helper functions.
Index ¶
- Constants
- Variables
- func Bytes2Hex(d []byte) string
- func CopyBytes(b []byte) (copiedBytes []byte)
- func DefaultDataDir() string
- func DefaultHttpEndpoint() string
- func DefaultIpcFile() string
- func DefaultWSEndpoint() string
- func FromHex(s string) []byte
- func Go(fn func())
- func GoViteTestDataDir() string
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func HomeDir() string
- func LeftPadBytes(slice []byte, l int) []byte
- func MakeDefaultLogger(absFilePath string) *lumberjack.Logger
- func MockAddress(i int) types.Address
- func MockHash(i int) types.Hash
- func MockHashBy(i1 int, i int) types.Hash
- func RightPadBytes(slice []byte, l int) []byte
- func SyncMapLen(m *sync.Map) uint64
- func ToHex(b []byte) stringdeprecated
- type CondTimer
- type Lifecycle
- type LifecycleStatus
- func (self *LifecycleStatus) GetStatus() int32
- func (self *LifecycleStatus) PostInit() bool
- func (self *LifecycleStatus) PostStart() bool
- func (self *LifecycleStatus) PostStop() bool
- func (self *LifecycleStatus) PreInit() bool
- func (self *LifecycleStatus) PreStart() bool
- func (self *LifecycleStatus) PreStop() bool
- func (self *LifecycleStatus) Stopped() bool
- type NonBlockLock
- type TimeoutCond
- type Version
Constants ¶
View Source
const ( DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server DefaultHTTPPort = 48132 // Default TCP port for the HTTP RPC server DefaultWSHost = "localhost" // Default host interface for the websocket RPC server DefaultWSPort = 31420 // Default TCP port for the websocket RPC server DefaultP2PPort = 8483 )
Variables ¶
View Source
var TimeoutErr = errors.New("timeout")
Functions ¶
func DefaultHttpEndpoint ¶
func DefaultHttpEndpoint() string
func DefaultIpcFile ¶
func DefaultIpcFile() string
func DefaultWSEndpoint ¶
func DefaultWSEndpoint() string
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func MakeDefaultLogger ¶
func MakeDefaultLogger(absFilePath string) *lumberjack.Logger
func MockAddress ¶
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func SyncMapLen ¶
Types ¶
type CondTimer ¶
type CondTimer struct {
// contains filtered or unexported fields
}
func NewCondTimer ¶
func NewCondTimer() *CondTimer
type LifecycleStatus ¶
type LifecycleStatus struct {
Status int32 // 0:origin 1: initing 2:inited 3:starting 4:started 5:stopping 6:stopped
}
func (*LifecycleStatus) GetStatus ¶
func (self *LifecycleStatus) GetStatus() int32
func (*LifecycleStatus) PostInit ¶
func (self *LifecycleStatus) PostInit() bool
func (*LifecycleStatus) PostStart ¶
func (self *LifecycleStatus) PostStart() bool
func (*LifecycleStatus) PostStop ¶
func (self *LifecycleStatus) PostStop() bool
func (*LifecycleStatus) PreInit ¶
func (self *LifecycleStatus) PreInit() bool
func (*LifecycleStatus) PreStart ¶
func (self *LifecycleStatus) PreStart() bool
func (*LifecycleStatus) PreStop ¶
func (self *LifecycleStatus) PreStop() bool
func (*LifecycleStatus) Stopped ¶
func (self *LifecycleStatus) Stopped() bool
type NonBlockLock ¶
type NonBlockLock struct {
// contains filtered or unexported fields
}
func (*NonBlockLock) Lock ¶
func (self *NonBlockLock) Lock()
func (*NonBlockLock) TryLock ¶
func (self *NonBlockLock) TryLock() bool
func (*NonBlockLock) UnLock ¶
func (self *NonBlockLock) UnLock() bool
type TimeoutCond ¶ added in v1.3.2
func NewTimeoutCond ¶ added in v1.3.2
func NewTimeoutCond() *TimeoutCond
func (*TimeoutCond) Broadcast ¶ added in v1.3.2
func (self *TimeoutCond) Broadcast()
func (*TimeoutCond) Signal ¶ added in v1.3.2
func (self *TimeoutCond) Signal()
func (*TimeoutCond) Wait ¶ added in v1.3.2
func (self *TimeoutCond) Wait()
func (*TimeoutCond) WaitTimeout ¶ added in v1.3.2
func (self *TimeoutCond) WaitTimeout(t time.Duration) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
xleveldb
Package leveldb provides implementation of LevelDB key/value database.
|
Package leveldb provides implementation of LevelDB key/value database. |
xleveldb/cache
Package cache provides interface and implementation of a cache algorithms.
|
Package cache provides interface and implementation of a cache algorithms. |
xleveldb/comparer
Package comparer provides interface and implementation for ordering sets of data.
|
Package comparer provides interface and implementation for ordering sets of data. |
xleveldb/errors
Package errors provides common error types used throughout leveldb.
|
Package errors provides common error types used throughout leveldb. |
xleveldb/filter
Package filter provides interface and implementation of probabilistic data structure.
|
Package filter provides interface and implementation of probabilistic data structure. |
xleveldb/iterator
Package iterator provides interface and implementation to traverse over contents of a database.
|
Package iterator provides interface and implementation to traverse over contents of a database. |
xleveldb/journal
Package journal reads and writes sequences of journals.
|
Package journal reads and writes sequences of journals. |
xleveldb/memdb
Package memdb provides in-memory key/value database implementation.
|
Package memdb provides in-memory key/value database implementation. |
xleveldb/opt
Package opt provides sets of options used by LevelDB.
|
Package opt provides sets of options used by LevelDB. |
xleveldb/storage
Package storage provides storage abstraction for LevelDB.
|
Package storage provides storage abstraction for LevelDB. |
xleveldb/table
Package table allows read and write sorted key/value.
|
Package table allows read and write sorted key/value. |
xleveldb/util
Package util provides utilities used throughout leveldb.
|
Package util provides utilities used throughout leveldb. |
Package hexutil implements hex encoding with 0x prefix.
|
Package hexutil implements hex encoding with 0x prefix. |
Package math provides integer math utilities.
|
Package math provides integer math utilities. |
Click to show internal directories.
Click to hide internal directories.