util

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package util contains utility analyzer functionality.

Index

Constants

View Source
const (

	// SHA256 of empty string.
	// oasis-core tags event that are not associated with any real transactions.
	// For example, the DebondingStart escrow event.
	EmptyTxHash = "c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a"
	// The zero-value transaction hash.
	// oasis-core tags runtime events that are not associated with any real transactions.
	// See https://github.com/oasisprotocol/oasis-core/blob/b6c20732c43f95b51d31e42968acd118cf0ac1b6/go/runtime/transaction/tags.go#L5-L7
	ZeroTxHash = "0000000000000000000000000000000000000000000000000000000000000000"
)

Variables

This section is empty.

Functions

func ClosingChannel added in v0.1.13

func ClosingChannel(wg *sync.WaitGroup) <-chan struct{}

closingChannel returns a channel that closes when the wait group `wg` is done.

func CurrentBound

func CurrentBound(cs staking.CommissionSchedule, now beacon.EpochTime) (currentBound *staking.CommissionRateBoundStep, epochEnd uint64)

CurrentBound returns the bound at the latest rate step that has started or nil if no step has started.

func SanitizeTxHash

func SanitizeTxHash(hash string) *string

Types

type Backoff

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

Backoff implements retry backoff on failure.

func NewBackoff

func NewBackoff(minTimeoutStep time.Duration, maximumTimeout time.Duration) (*Backoff, error)

NewBackoff returns a new exponential backoff.

Initial timeout is always 0. The minTimeoutStep is the timeout step on first failure. A call to `Success()` that lowers the timeout below the minTimeoutStep, reduces the timeout back to 0. The maximum timeout is the maximum possible timeout to use.

func (*Backoff) Failure

func (b *Backoff) Failure()

Failure increases the backoff interval.

func (*Backoff) Reset

func (b *Backoff) Reset()

Reset resets the backoff.

func (*Backoff) Success

func (b *Backoff) Success()

Success slightly decreases the backoff interval.

func (*Backoff) Timeout

func (b *Backoff) Timeout() time.Duration

Timeout returns the backoff timeout.

func (*Backoff) Wait

func (b *Backoff) Wait()

Wait waits for the appropriate backoff interval.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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