common

package
v0.0.0-...-4aef51c Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package common is a generated protocol buffer package.

It is generated from these files:

common/types.proto

It has these top-level messages:

KVPair
KI64Pair

nolint: gas

Index

Constants

View Source
const (
	ANSIReset      = "\x1b[0m"
	ANSIBright     = "\x1b[1m"
	ANSIDim        = "\x1b[2m"
	ANSIUnderscore = "\x1b[4m"
	ANSIBlink      = "\x1b[5m"
	ANSIReverse    = "\x1b[7m"
	ANSIHidden     = "\x1b[8m"

	ANSIFgBlack   = "\x1b[30m"
	ANSIFgRed     = "\x1b[31m"
	ANSIFgGreen   = "\x1b[32m"
	ANSIFgYellow  = "\x1b[33m"
	ANSIFgBlue    = "\x1b[34m"
	ANSIFgMagenta = "\x1b[35m"
	ANSIFgCyan    = "\x1b[36m"
	ANSIFgWhite   = "\x1b[37m"

	ANSIBgBlack   = "\x1b[40m"
	ANSIBgRed     = "\x1b[41m"
	ANSIBgGreen   = "\x1b[42m"
	ANSIBgYellow  = "\x1b[43m"
	ANSIBgBlue    = "\x1b[44m"
	ANSIBgMagenta = "\x1b[45m"
	ANSIBgCyan    = "\x1b[46m"
	ANSIBgWhite   = "\x1b[47m"
)

Variables

View Source
var (
	ErrAlreadyStarted = errors.New("already started")
	ErrAlreadyStopped = errors.New("already stopped")
)
View Source
var (
	Zero256 = Word256{0}
	One256  = Word256{1}
)
View Source
var Fmt = fmt.Sprintf

Fmt shorthand, XXX DEPRECATED

View Source
var TimeLayout = "2006-01-02" //this represents YYYY-MM-DD

TimeLayout helps to parse a date string of the format YYYY-MM-DD

  Intended to be used with the following function:
	 time.Parse(TimeLayout, date)

Functions

func Arr

func Arr(items ...interface{}) []interface{}

func Black

func Black(args ...interface{}) string

func Blue

func Blue(args ...interface{}) string

func Connect

func Connect(protoAddr string) (net.Conn, error)

Connect dials the given address and returns a net.Conn. The protoAddr argument should be prefixed with the protocol, eg. "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock"

func Cyan

func Cyan(args ...interface{}) string

func EnsureDir

func EnsureDir(dir string, mode os.FileMode) error

func Exit

func Exit(s string)

func ExpUint64

func ExpUint64(a, b uint64) uint64

func FileExists

func FileExists(filePath string) bool

func Fingerprint

func Fingerprint(slice []byte) []byte

Fingerprint returns the first 6 bytes of a byte slice. If the slice is less than 6 bytes, the fingerprint contains trailing zeroes.

func GetInt64BE

func GetInt64BE(src []byte) int64

func GetInt64LE

func GetInt64LE(src []byte) int64

func GetUint64BE

func GetUint64BE(src []byte) uint64

func GetUint64LE

func GetUint64LE(src []byte) uint64

func GoPath

func GoPath() string

GoPath returns GOPATH env variable value. If it is not set, this function will try to call `go env GOPATH` subcommand.

func Green

func Green(args ...interface{}) string

func Int64FromWord256

func Int64FromWord256(word Word256) int64

func IntInSlice

func IntInSlice(a int, list []int) bool

IntInSlice returns true if a is found in the list.

func IsDirEmpty

func IsDirEmpty(name string) (bool, error)

func IsHex

func IsHex(s string) bool

IsHex returns true for non-empty hex-string prefixed with "0x"

func IsZeros

func IsZeros(slice []byte) bool

func Kill

func Kill() error

Kill the running process by sending itself SIGTERM.

func LeftPadBytes

func LeftPadBytes(slice []byte, l int) []byte

func LeftPadString

func LeftPadString(s string, totalLength int) string

LeftPadString adds spaces to the left of a string to make it length totalLength

func Magenta

func Magenta(args ...interface{}) string

func MaxInt

func MaxInt(a, b int) int

func MaxInt16

func MaxInt16(a, b int16) int16

func MaxInt32

func MaxInt32(a, b int32) int32

func MaxInt64

func MaxInt64(a, b int64) int64

func MaxInt8

func MaxInt8(a, b int8) int8

func MaxUint

func MaxUint(a, b uint) uint

func MaxUint16

func MaxUint16(a, b uint16) uint16

func MaxUint32

func MaxUint32(a, b uint32) uint32

func MaxUint64

func MaxUint64(a, b uint64) uint64

func MaxUint8

func MaxUint8(a, b uint8) uint8

func MinInt

func MinInt(a, b int) int

func MinInt16

func MinInt16(a, b int16) int16

func MinInt32

func MinInt32(a, b int32) int32

func MinInt64

func MinInt64(a, b int64) int64

func MinInt8

func MinInt8(a, b int8) int8

func MinUint

func MinUint(a, b uint) uint

func MinUint16

func MinUint16(a, b uint16) uint16

func MinUint32

func MinUint32(a, b uint32) uint32

func MinUint64

func MinUint64(a, b uint64) uint64

func MinUint8

func MinUint8(a, b uint8) uint8

func MustReadFile

func MustReadFile(filePath string) []byte

func MustWriteFile

func MustWriteFile(filePath string, contents []byte, mode os.FileMode)

func PanicConsensus

func PanicConsensus(v interface{})

Indicates a failure of consensus. Someone was malicious or something has gone horribly wrong. These should really boot us into an "emergency-recover" mode XXX DEPRECATED

func PanicCrisis

func PanicCrisis(v interface{})

A panic here means something has gone horribly wrong, in the form of data corruption or failure of the operating system. In a correct/healthy system, these should never fire. If they do, it's indicative of a much more serious problem. XXX DEPRECATED

func PanicQ

func PanicQ(v interface{})

For those times when we're not sure if we should panic XXX DEPRECATED

func PanicSanity

func PanicSanity(v interface{})

A panic resulting from a sanity check means there is a programmer error and some guarantee is not satisfied. XXX DEPRECATED

func Parallel

func Parallel(tasks ...func())

func ParseDateRange

func ParseDateRange(dateRange string) (startDate, endDate time.Time, err error)

ParseDateRange parses a date range string of the format start:end

  where the start and end date are of the format YYYY-MM-DD.
  The parsed dates are time.Time and will return the zero time for
  unbounded dates, ex:
  unbounded start:	:2000-12-31
	 unbounded end: 	2000-12-31:

func Prompt

func Prompt(prompt string, defaultValue string) (string, error)

func ProtocolAndAddress

func ProtocolAndAddress(listenAddr string) (string, string)

ProtocolAndAddress splits an address into the protocol and address components. For instance, "tcp://127.0.0.1:8080" will be split into "tcp" and "127.0.0.1:8080". If the address has no protocol prefix, the default is "tcp".

func PutInt64BE

func PutInt64BE(dest []byte, i int64)

func PutInt64LE

func PutInt64LE(dest []byte, i int64)

func PutUint64BE

func PutUint64BE(dest []byte, i uint64)

func PutUint64LE

func PutUint64LE(dest []byte, i uint64)

func RandBytes

func RandBytes(n int) []byte

RandBytes returns n random bytes from the OS's source of entropy ie. via crypto/rand. It is not safe for cryptographic usage.

func RandFloat32

func RandFloat32() float32

It is not safe for cryptographic usage.

func RandInt

func RandInt() int

It is not safe for cryptographic usage.

func RandInt16

func RandInt16() int16

It is not safe for cryptographic usage.

func RandInt31

func RandInt31() int32

It is not safe for cryptographic usage.

func RandInt32

func RandInt32() int32

It is not safe for cryptographic usage.

func RandInt63

func RandInt63() int64

It is not safe for cryptographic usage.

func RandInt64

func RandInt64() int64

It is not safe for cryptographic usage.

func RandIntn

func RandIntn(n int) int

RandIntn returns, as an int, a non-negative pseudo-random number in [0, n). It panics if n <= 0. It is not safe for cryptographic usage.

func RandPerm

func RandPerm(n int) []int

RandPerm returns a pseudo-random permutation of n integers in [0, n). It is not safe for cryptographic usage.

func RandStr

func RandStr(length int) string

Constructs an alphanumeric string of given length. It is not safe for cryptographic usage.

func RandTime

func RandTime() time.Time

It is not safe for cryptographic usage.

func RandUint

func RandUint() uint

It is not safe for cryptographic usage.

func RandUint16

func RandUint16() uint16

It is not safe for cryptographic usage.

func RandUint16Exp

func RandUint16Exp() uint16

Distributed pseudo-exponentially to test for various cases It is not safe for cryptographic usage.

func RandUint32

func RandUint32() uint32

It is not safe for cryptographic usage.

func RandUint32Exp

func RandUint32Exp() uint32

Distributed pseudo-exponentially to test for various cases It is not safe for cryptographic usage.

func RandUint64

func RandUint64() uint64

It is not safe for cryptographic usage.

func RandUint64Exp

func RandUint64Exp() uint64

Distributed pseudo-exponentially to test for various cases It is not safe for cryptographic usage.

func ReadFile

func ReadFile(filePath string) ([]byte, error)

func Red

func Red(args ...interface{}) string

func RightPadBytes

func RightPadBytes(slice []byte, l int) []byte

func RightPadString

func RightPadString(s string, totalLength int) string

RightPadString adds spaces to the right of a string to make it length totalLength

func SearchUint64s

func SearchUint64s(a []uint64, x uint64) int

func StringInSlice

func StringInSlice(a string, list []string) bool

StringInSlice returns true if a is found the list.

func StripHex

func StripHex(s string) string

StripHex returns hex string without leading "0x"

func Tempdir

func Tempdir(prefix string) (*os.File, string)

func Tempfile

func Tempfile(prefix string) (*os.File, string)

func TrapSignal

func TrapSignal(cb func())

TrapSignal catches the SIGTERM and executes cb function. After that it exits with code 1.

func TrimmedString

func TrimmedString(b []byte) string

func Tuple256Split

func Tuple256Split(t Tuple256) (Word256, Word256)

func Uint64FromWord256

func Uint64FromWord256(word Word256) uint64

func White

func White(args ...interface{}) string

func WriteFile

func WriteFile(filePath string, contents []byte, mode os.FileMode) error

func WriteFileAtomic

func WriteFileAtomic(filePath string, newBytes []byte, mode os.FileMode) error

WriteFileAtomic writes newBytes to temp and atomically moves to filePath when everything else succeeds.

func Yellow

func Yellow(args ...interface{}) string

Types

type BaseService

type BaseService struct {
	Logger log.Logger
	// contains filtered or unexported fields
}

Classical-inheritance-style service declarations. Services can be started, then stopped, then optionally restarted.

Users can override the OnStart/OnStop methods. In the absence of errors, these methods are guaranteed to be called at most once. If OnStart returns an error, service won't be marked as started, so the user can call Start again.

A call to Reset will panic, unless OnReset is overwritten, allowing OnStart/OnStop to be called again.

The caller must ensure that Start and Stop are not called concurrently.

It is ok to call Stop without calling Start first.

Typical usage:

type FooService struct {
	BaseService
	// private fields
}

func NewFooService() *FooService {
	fs := &FooService{
		// init
	}
	fs.BaseService = *NewBaseService(log, "FooService", fs)
	return fs
}

func (fs *FooService) OnStart() error {
	fs.BaseService.OnStart() // Always call the overridden method.
	// initialize private fields
	// start subroutines, etc.
}

func (fs *FooService) OnStop() error {
	fs.BaseService.OnStop() // Always call the overridden method.
	// close/destroy private fields
	// stop subroutines, etc.
}

func NewBaseService

func NewBaseService(logger log.Logger, name string, impl Service) *BaseService

NewBaseService creates a new BaseService.

func (*BaseService) IsRunning

func (bs *BaseService) IsRunning() bool

IsRunning implements Service by returning true or false depending on the service's state.

func (*BaseService) OnReset

func (bs *BaseService) OnReset() error

OnReset implements Service by panicking.

func (*BaseService) OnStart

func (bs *BaseService) OnStart() error

OnStart implements Service by doing nothing. NOTE: Do not put anything in here, that way users don't need to call BaseService.OnStart()

func (*BaseService) OnStop

func (bs *BaseService) OnStop()

OnStop implements Service by doing nothing. NOTE: Do not put anything in here, that way users don't need to call BaseService.OnStop()

func (*BaseService) Quit

func (bs *BaseService) Quit() <-chan struct{}

Quit Implements Service by returning a quit channel.

func (*BaseService) Reset

func (bs *BaseService) Reset() error

Reset implements Service by calling OnReset callback (if defined). An error will be returned if the service is running.

func (*BaseService) SetLogger

func (bs *BaseService) SetLogger(l log.Logger)

SetLogger implements Service by setting a logger.

func (*BaseService) Start

func (bs *BaseService) Start() error

Start implements Service by calling OnStart (if defined). An error will be returned if the service is already running or stopped. Not to start the stopped service, you need to call Reset.

func (*BaseService) Stop

func (bs *BaseService) Stop() error

Stop implements Service by calling OnStop (if defined) and closing quit channel. An error will be returned if the service is already stopped.

func (*BaseService) String

func (bs *BaseService) String() string

String implements Servce by returning a string representation of the service.

func (*BaseService) Wait

func (bs *BaseService) Wait()

Wait blocks until the service is stopped.

type BitArray

type BitArray struct {
	Bits  int      `json:"bits"`  // NOTE: persisted via reflect, must be exported
	Elems []uint64 `json:"elems"` // NOTE: persisted via reflect, must be exported
	// contains filtered or unexported fields
}

func NewBitArray

func NewBitArray(bits int) *BitArray

There is no BitArray whose Size is 0. Use nil instead.

func (*BitArray) And

func (bA *BitArray) And(o *BitArray) *BitArray

Returns a BitArray of smaller bit size.

func (*BitArray) Bytes

func (bA *BitArray) Bytes() []byte

func (*BitArray) Copy

func (bA *BitArray) Copy() *BitArray

func (*BitArray) GetIndex

func (bA *BitArray) GetIndex(i int) bool

NOTE: behavior is undefined if i >= bA.Bits

func (*BitArray) IsEmpty

func (bA *BitArray) IsEmpty() bool

func (*BitArray) IsFull

func (bA *BitArray) IsFull() bool

func (*BitArray) Not

func (bA *BitArray) Not() *BitArray

func (*BitArray) Or

func (bA *BitArray) Or(o *BitArray) *BitArray

Returns a BitArray of larger bits size.

func (*BitArray) PickRandom

func (bA *BitArray) PickRandom() (int, bool)

func (*BitArray) SetIndex

func (bA *BitArray) SetIndex(i int, v bool) bool

NOTE: behavior is undefined if i >= bA.Bits

func (*BitArray) Size

func (bA *BitArray) Size() int

func (*BitArray) String

func (bA *BitArray) String() string

func (*BitArray) StringIndented

func (bA *BitArray) StringIndented(indent string) string

func (*BitArray) Sub

func (bA *BitArray) Sub(o *BitArray) *BitArray

func (*BitArray) Update

func (bA *BitArray) Update(o *BitArray)

NOTE: other bitarray o is not locked when reading, so if necessary, caller must copy or lock o prior to calling Update. If bA is nil, does nothing.

type BufferCloser

type BufferCloser struct {
	bytes.Buffer
	Closed bool
}

NOTE: Not goroutine safe

func NewBufferCloser

func NewBufferCloser(buf []byte) *BufferCloser

func (*BufferCloser) Close

func (bc *BufferCloser) Close() error

func (*BufferCloser) Write

func (bc *BufferCloser) Write(p []byte) (n int, err error)

func (*BufferCloser) WriteByte

func (bc *BufferCloser) WriteByte(c byte) error

func (*BufferCloser) WriteRune

func (bc *BufferCloser) WriteRune(r rune) (n int, err error)

func (*BufferCloser) WriteString

func (bc *BufferCloser) WriteString(s string) (n int, err error)

type CMap

type CMap struct {
	// contains filtered or unexported fields
}

CMap is a goroutine-safe map

func NewCMap

func NewCMap() *CMap

func (*CMap) Clear

func (cm *CMap) Clear()

func (*CMap) Delete

func (cm *CMap) Delete(key string)

func (*CMap) Get

func (cm *CMap) Get(key string) interface{}

func (*CMap) Has

func (cm *CMap) Has(key string) bool

func (*CMap) Keys

func (cm *CMap) Keys() []string

func (*CMap) Set

func (cm *CMap) Set(key string, value interface{})

func (*CMap) Size

func (cm *CMap) Size() int

func (*CMap) Values

func (cm *CMap) Values() []interface{}

type Comparable

type Comparable interface {
	Less(o interface{}) bool
}

type Heap

type Heap struct {
	// contains filtered or unexported fields
}

Example usage:

``` h := NewHeap()

h.Push("msg1", 1) h.Push("msg3", 3) h.Push("msg2", 2)

fmt.Println(h.Pop()) // msg1 fmt.Println(h.Pop()) // msg2 fmt.Println(h.Pop()) // msg3 ```

func NewHeap

func NewHeap() *Heap

func (*Heap) Len

func (h *Heap) Len() int64

func (*Heap) Peek

func (h *Heap) Peek() interface{}

func (*Heap) Pop

func (h *Heap) Pop() interface{}

func (*Heap) Push

func (h *Heap) Push(value interface{}, priority int)

func (*Heap) PushBytes

func (h *Heap) PushBytes(value interface{}, priority []byte)

func (*Heap) PushComparable

func (h *Heap) PushComparable(value interface{}, priority Comparable)

func (*Heap) Update

func (h *Heap) Update(value interface{}, priority Comparable)

type HexBytes

type HexBytes []byte

The main purpose of HexBytes is to enable HEX-encoding for json/encoding.

func (HexBytes) Bytes

func (bz HexBytes) Bytes() []byte

Allow it to fulfill various interfaces in light-client, etc...

func (HexBytes) Marshal

func (bz HexBytes) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (HexBytes) MarshalJSON

func (bz HexBytes) MarshalJSON() ([]byte, error)

This is the point of Bytes.

func (HexBytes) String

func (bz HexBytes) String() string

func (*HexBytes) Unmarshal

func (bz *HexBytes) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*HexBytes) UnmarshalJSON

func (bz *HexBytes) UnmarshalJSON(data []byte) error

This is the point of Bytes.

type KI64Pair

type KI64Pair struct {
	Key   []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value int64  `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
}

Define these here for compatibility but use tmlibs/common.KI64Pair.

func (*KI64Pair) Descriptor

func (*KI64Pair) Descriptor() ([]byte, []int)

func (*KI64Pair) GetKey

func (m *KI64Pair) GetKey() []byte

func (*KI64Pair) GetValue

func (m *KI64Pair) GetValue() int64

func (*KI64Pair) ProtoMessage

func (*KI64Pair) ProtoMessage()

func (*KI64Pair) Reset

func (m *KI64Pair) Reset()

func (*KI64Pair) String

func (m *KI64Pair) String() string

type KI64Pairs

type KI64Pairs []KI64Pair

func (KI64Pairs) Len

func (kvs KI64Pairs) Len() int

Sorting

func (KI64Pairs) Less

func (kvs KI64Pairs) Less(i, j int) bool

func (KI64Pairs) Sort

func (kvs KI64Pairs) Sort()

func (KI64Pairs) Swap

func (kvs KI64Pairs) Swap(i, j int)

type KVPair

type KVPair struct {
	Key   []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

Define these here for compatibility but use tmlibs/common.KVPair.

func (*KVPair) Descriptor

func (*KVPair) Descriptor() ([]byte, []int)

func (*KVPair) GetKey

func (m *KVPair) GetKey() []byte

func (*KVPair) GetValue

func (m *KVPair) GetValue() []byte

func (*KVPair) ProtoMessage

func (*KVPair) ProtoMessage()

func (*KVPair) Reset

func (m *KVPair) Reset()

func (*KVPair) String

func (m *KVPair) String() string

type KVPairs

type KVPairs []KVPair

func (KVPairs) Len

func (kvs KVPairs) Len() int

Sorting

func (KVPairs) Less

func (kvs KVPairs) Less(i, j int) bool

func (KVPairs) Sort

func (kvs KVPairs) Sort()

func (KVPairs) Swap

func (kvs KVPairs) Swap(i, j int)

type PrefixedReader

type PrefixedReader struct {
	Prefix []byte
	// contains filtered or unexported fields
}

func NewPrefixedReader

func NewPrefixedReader(prefix []byte, reader io.Reader) *PrefixedReader

func (*PrefixedReader) Read

func (pr *PrefixedReader) Read(p []byte) (n int, err error)

type RepeatTimer

type RepeatTimer struct {
	// contains filtered or unexported fields
}

RepeatTimer repeatedly sends a struct{}{} to `.Chan()` after each `dur` period. (It's good for keeping connections alive.) A RepeatTimer must be stopped, or it will keep a goroutine alive.

func NewRepeatTimer

func NewRepeatTimer(name string, dur time.Duration) *RepeatTimer

NewRepeatTimer returns a RepeatTimer with a defaultTicker.

func NewRepeatTimerWithTickerMaker

func NewRepeatTimerWithTickerMaker(name string, dur time.Duration, tm TickerMaker) *RepeatTimer

NewRepeatTimerWithTicker returns a RepeatTimer with the given ticker maker.

func (*RepeatTimer) Chan

func (t *RepeatTimer) Chan() <-chan time.Time

func (*RepeatTimer) Reset

func (t *RepeatTimer) Reset()

Wait the duration again before firing.

func (*RepeatTimer) Stop

func (t *RepeatTimer) Stop()

type Service

type Service interface {
	// Start the service.
	// If it's already started or stopped, will return an error.
	// If OnStart() returns an error, it's returned by Start()
	Start() error
	OnStart() error

	// Stop the service.
	// If it's already stopped, will return an error.
	// OnStop must never error.
	Stop() error
	OnStop()

	// Reset the service.
	// Panics by default - must be overwritten to enable reset.
	Reset() error
	OnReset() error

	// Return true if the service is running
	IsRunning() bool

	// Quit returns a channel, which is closed once service is stopped.
	Quit() <-chan struct{}

	// String representation of the service
	String() string

	// SetLogger sets a logger.
	SetLogger(log.Logger)
}

Service defines a service that can be started, stopped, and reset.

type StackError

type StackError struct {
	Err   interface{}
	Stack []byte
}

func (StackError) Error

func (se StackError) Error() string

func (StackError) String

func (se StackError) String() string

type ThrottleTimer

type ThrottleTimer struct {
	Name string
	Ch   chan struct{}
	// contains filtered or unexported fields
}

ThrottleTimer fires an event at most "dur" after each .Set() call. If a short burst of .Set() calls happens, ThrottleTimer fires once. If a long continuous burst of .Set() calls happens, ThrottleTimer fires at most once every "dur".

func NewThrottleTimer

func NewThrottleTimer(name string, dur time.Duration) *ThrottleTimer

func (*ThrottleTimer) Set

func (t *ThrottleTimer) Set()

func (*ThrottleTimer) Stop

func (t *ThrottleTimer) Stop() bool

For ease of .Stop()'ing services before .Start()'ing them, we ignore .Stop()'s on nil ThrottleTimers

func (*ThrottleTimer) Unset

func (t *ThrottleTimer) Unset()

type Ticker

type Ticker interface {

	// Never changes, never closes.
	Chan() <-chan time.Time

	// Stopping a stopped Ticker will panic.
	Stop()
}

Ticker is a basic ticker interface.

type TickerMaker

type TickerMaker func(dur time.Duration) Ticker

Used by RepeatTimer the first time, and every time it's Reset() after Stop().

func NewLogicalTickerMaker

func NewLogicalTickerMaker(source chan time.Time) TickerMaker

Construct a TickerMaker that always uses `source`. It's useful for simulating a deterministic clock.

type Tuple256

type Tuple256 struct {
	First  Word256
	Second Word256
}

func (Tuple256) Compare

func (tuple Tuple256) Compare(other Tuple256) int

type Tuple256Slice

type Tuple256Slice []Tuple256

func (Tuple256Slice) Len

func (p Tuple256Slice) Len() int

func (Tuple256Slice) Less

func (p Tuple256Slice) Less(i, j int) bool

func (Tuple256Slice) Sort

func (p Tuple256Slice) Sort()

func (Tuple256Slice) Swap

func (p Tuple256Slice) Swap(i, j int)

type Uint64Slice

type Uint64Slice []uint64

func (Uint64Slice) Len

func (p Uint64Slice) Len() int

func (Uint64Slice) Less

func (p Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Search

func (p Uint64Slice) Search(x uint64) int

func (Uint64Slice) Sort

func (p Uint64Slice) Sort()

func (Uint64Slice) Swap

func (p Uint64Slice) Swap(i, j int)

type Word256

type Word256 [32]byte

func Int64ToWord256

func Int64ToWord256(i int64) Word256

func LeftPadWord256

func LeftPadWord256(bz []byte) (word Word256)

func RightPadWord256

func RightPadWord256(bz []byte) (word Word256)

func Uint64ToWord256

func Uint64ToWord256(i uint64) Word256

func (Word256) Bytes

func (w Word256) Bytes() []byte

func (Word256) Compare

func (w Word256) Compare(other Word256) int

func (Word256) Copy

func (w Word256) Copy() Word256

func (Word256) IsZero

func (w Word256) IsZero() bool

func (Word256) Postfix

func (w Word256) Postfix(n int) []byte

func (Word256) Prefix

func (w Word256) Prefix(n int) []byte

func (Word256) String

func (w Word256) String() string

func (Word256) TrimmedString

func (w Word256) TrimmedString() string

Jump to

Keyboard shortcuts

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