utils

package
v0.0.0-...-51c274e Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndSortTxSetAsBundle

func CheckAndSortTxSetAsBundle(txSet []*Transaction) ([]*Transaction, error)

check consistency of the indices of the set and return sorted slice. if finds inconsistency, returns same set and error

func CheckBundle

func CheckBundle(txSet []Transaction) error

check consistency of the indices of the set and return error if not consistent

func ExtractBundleTransactionsByTail

func ExtractBundleTransactionsByTail(tail *Transaction, allTx []Transaction) []*Transaction

func FindTail

func FindTail(txs Transactions) *Transaction

func FindTransactionObjects

func FindTransactionObjects(query FindTransactionsQuery, api *API) (Transactions, error)

Finds transactions, loads trytes (in pieces if necessary) and parses to transactions

func FindTransactionObjectsMulti

func FindTransactionObjectsMulti(query FindTransactionsQuery, mapi multiapi.MultiAPI, apiret *multiapi.MultiCallRet) (Transactions, error)

func FindTxByHash

func FindTxByHash(hash Trytes, txList []Transaction) (*Transaction, bool)

by hash find specific tx in a set of transaction

func FindTxByHashP

func FindTxByHashP(hash Trytes, txList []*Transaction) (*Transaction, bool)

func GetMiotaPriceUSD

func GetMiotaPriceUSD() (float64, error)

func IsAnyConfirmed

func IsAnyConfirmed(transactions Hashes, api *API) (bool, error)

func IsAnyConfirmedMulti

func IsAnyConfirmedMulti(transactions Hashes, mapi multiapi.MultiAPI, ret *multiapi.MultiCallRet) (bool, error)

func IsBundleHashConfirmed

func IsBundleHashConfirmed(bundleHash Trytes, api *API) (bool, error)

func IsBundleHashConfirmedMulti

func IsBundleHashConfirmedMulti(bundleHash Trytes, mapi multiapi.MultiAPI, ret *multiapi.MultiCallRet) (bool, error)

func KerlTrytes

func KerlTrytes(s Trytes) (Trytes, error)

calculates hash of the same length

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func OpenSocket

func OpenSocket(uri string, timeoutSec int) (zmq4.Socket, error)

func OpenSocketAndSubscribe

func OpenSocketAndSubscribe(uri string, topics []string) (zmq4.Socket, error)

func SinceUnixMs

func SinceUnixMs(ts uint64) uint64

func StringInSlice

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

func TailFromBundleTrytes

func TailFromBundleTrytes(bundleTrytes []Trytes) (*Transaction, error)

func TransactionSetToBundleTrytes

func TransactionSetToBundleTrytes(txSet []*Transaction) ([]Trytes, error)

func TrytesInSet

func TrytesInSet(a Trytes, list []Trytes) bool

func UnixMs

func UnixMs(t time.Time) uint64

func UnixMsNow

func UnixMsNow() uint64

func UnixSec

func UnixSec(t time.Time) uint64

func Wfile

func Wfile(s string)

Types

type DummyAEC

type DummyAEC struct{}

func (*DummyAEC) CheckError

func (*DummyAEC) CheckError(endpoint string, err error) bool

type ErrorCounter

type ErrorCounter interface {
	CheckError(endpoint string, err error) bool
}

type RingArray

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

func NewRingArray

func NewRingArray(len int) *RingArray

func (*RingArray) AvgGT

func (ra *RingArray) AvgGT(n uint64) uint64

func (*RingArray) CountGT

func (ra *RingArray) CountGT(n uint64) uint64

func (*RingArray) Len

func (ra *RingArray) Len() int

func (*RingArray) Min

func (ra *RingArray) Min() uint64

func (*RingArray) Push

func (ra *RingArray) Push(value uint64)

func (*RingArray) Reset

func (ra *RingArray) Reset()

func (*RingArray) SumGT

func (ra *RingArray) SumGT(n uint64) uint64

type RotateWriter

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

func NewRotateWriter

func NewRotateWriter(dir string, filename string, rot time.Duration, retain time.Duration) (*RotateWriter, error)

Make a new RotateWriter. Return nil if error occurs during setup.

func (*RotateWriter) Write

func (w *RotateWriter) Write(output []byte) (int, error)

Write satisfies the io.Writer interface.

Jump to

Keyboard shortcuts

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