Documentation ¶
Index ¶
- Variables
- func FakeEpoch() idx.Epoch
- func FakeHash(seed ...int64) (h common.Hash)
- func FakePeer(seed ...int64) idx.StakerID
- func FromBytes(b []byte) common.Hash
- func GetEventName(e Event) string
- func GetNodeName(n idx.StakerID) string
- func Of(data ...[]byte) (hash common.Hash)
- func SetEventName(e Event, name string)
- func SetNodeName(n idx.StakerID, name string)
- type Event
- func (h *Event) Big() *big.Int
- func (h Event) Bytes() []byte
- func (h Event) Epoch() idx.Epoch
- func (h Event) FullID() string
- func (h Event) Hex() string
- func (h *Event) IsZero() bool
- func (h Event) Lamport() idx.Lamport
- func (h *Event) SetBytes(raw []byte)
- func (h Event) ShortID(precision int) string
- func (h Event) String() string
- type Events
- type EventsSet
- type EventsStack
- type OrderedEvents
- type Transaction
Constants ¶
This section is empty.
Variables ¶
var ( // Zero is an empty hash. Zero = common.Hash{} )
var ( // ZeroEvent is a hash of virtual initial event. ZeroEvent = Event{} )
var ( // ZeroTransaction is a hash of virtual initial transaction. ZeroTransaction = Transaction{} )
Functions ¶
func FromBytes ¶
FromBytes converts bytes to hash. If b is larger than len(h), b will be cropped from the left.
func GetEventName ¶
GetEventName gets an optional human readable alias of event hash.
func GetNodeName ¶
GetNodeName gets an optional human readable alias of node address.
func SetEventName ¶
SetEventName sets an optional human readable alias of event hash in log.
func SetNodeName ¶
SetNodeName sets an optional human readable alias of node address in log.
Types ¶
type Event ¶
Event is a unique identifier of event. It is a hash of Event.
func BytesToEvent ¶
BytesToEvent converts bytes to event hash. If b is larger than len(h), b will be cropped from the left.
func FakeEvent ¶
func FakeEvent() (h Event)
FakeEvent generates random fake event hash with the same epoch for testing purpose.
func HexToEventHash ¶
HexToEventHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.
func (*Event) SetBytes ¶
SetBytes converts bytes to event hash. If b is larger than len(h), b will be cropped from the left.
type Events ¶
type Events []Event
Events is a slice of event hashes.
func FakeEvents ¶
FakeEvents generates random hashes of fake event with the same epoch for testing purpose.
type EventsSet ¶
type EventsSet map[Event]struct{}
EventsSet provides additional methods of event hash index.
type EventsStack ¶
type EventsStack []Event
type OrderedEvents ¶
type OrderedEvents []Event
OrderedEvents is a sortable slice of event hashes.
func WireToOrderedEvents ¶
func WireToOrderedEvents(buf [][]byte) OrderedEvents
WireToOrderedEvents converts from simple slice.
func (OrderedEvents) Len ¶
func (hh OrderedEvents) Len() int
func (OrderedEvents) Less ¶
func (hh OrderedEvents) Less(i, j int) bool
func (OrderedEvents) String ¶
func (hh OrderedEvents) String() string
String returns string representation.
func (OrderedEvents) Swap ¶
func (hh OrderedEvents) Swap(i, j int)
func (OrderedEvents) ToWire ¶
func (hh OrderedEvents) ToWire() [][]byte
ToWire converts to simple slice.
type Transaction ¶
Transaction is a unique identifier of internal transaction. It is a hash of Transaction.
func FakeTransaction ¶
func FakeTransaction() Transaction
FakeTransaction generates random fake hash for testing purpose.
func HexToTransactionHash ¶
func HexToTransactionHash(s string) Transaction
HexToTransactionHash sets byte representation of s to hash. If b is larger than len(h), b will be cropped from the left.
func (Transaction) Hex ¶
func (h Transaction) Hex() string
Hex converts an event hash to a hex string.
func (*Transaction) IsZero ¶
func (h *Transaction) IsZero() bool
IsZero returns true if hash is empty.