tools

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HashLength = 32
)

Lengths of hashes and addresses in bytes.

Variables

This section is empty.

Functions

func BytesToHash

func BytesToHash(b []byte) types.Hash

BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.

func FromHex

func FromHex(s string) []byte

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".

func Hex2Bytes

func Hex2Bytes(str string) []byte

Hex2Bytes returns the bytes represented by the hexadecimal string str.

func HexToHash

func HexToHash(s string) types.Hash

HexToHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.

func NewP2PTestEventCenter

func NewP2PTestEventCenter() types.EventCenter

Types

type P2PTestEventCenter

type P2PTestEventCenter struct {
	Subscribers map[types.EventType]map[types.Subscriber]types.EventFunc
	// contains filtered or unexported fields
}

func (*P2PTestEventCenter) Notify

func (e *P2PTestEventCenter) Notify(eventType types.EventType, value interface{}) (err error)

Notify subscribers that Subscribe specified event

func (*P2PTestEventCenter) NotifyAll

func (e *P2PTestEventCenter) NotifyAll() (errs []error)

Notify all event subscribers

func (*P2PTestEventCenter) NotifySubscriber

func (e *P2PTestEventCenter) NotifySubscriber(eventFunc types.EventFunc, value interface{})

func (*P2PTestEventCenter) Subscribe

func (e *P2PTestEventCenter) Subscribe(eventType types.EventType, eventFunc types.EventFunc) types.Subscriber

adds a new subscriber to P2PTestEventCenter.

func (*P2PTestEventCenter) UnSubscribe

func (e *P2PTestEventCenter) UnSubscribe(eventType types.EventType, subscriber types.Subscriber) (err error)

UnSubscribe removes the specified subscriber

func (*P2PTestEventCenter) UnSubscribeAll

func (e *P2PTestEventCenter) UnSubscribeAll()

unsubscribe all event and subscriber elegant

Directories

Path Synopsis
statistics

Jump to

Keyboard shortcuts

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