utils

package
v0.4.8-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: GPL-3.0, LGPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigNumEqual added in v0.2.8

func BigNumEqual(x, y *big.Int) bool

BigNumEqual returns true if x and y are equivalent ie. both nil or both contain the same value.

func IncrOne added in v0.3.0

func IncrOne(bytes []byte)

IncrOne increments bytes value by one

func IsForkTransition

func IsForkTransition(fork *big.Int, parent *big.Int, current *big.Int) bool

IsForkTransition returns true if [fork] activates during the transition from [parent] to [current]. Note: this works for both block number and timestamp activated forks.

func IsForked

func IsForked(s, head *big.Int) bool

IsForked returns whether a fork scheduled at block s is active at the given head block. Note: [s] and [head] can be either a block number or a block timestamp.

Types

type MeteredCache added in v0.4.1

type MeteredCache struct {
	*fastcache.Cache
	// contains filtered or unexported fields
}

MeteredCache wraps *fastcache.Cache and periodically pulls stats from it.

func NewMeteredCache added in v0.4.1

func NewMeteredCache(size int, journal string, namespace string, updateFrequency uint64) *MeteredCache

NewMeteredCache returns a new MeteredCache that will update stats to the provided namespace once per each [updateFrequency] operations. Note: if [updateFrequency] is passed as 0, it will be treated as 1.

func (*MeteredCache) Del added in v0.4.1

func (mc *MeteredCache) Del(k []byte)

func (*MeteredCache) Get added in v0.4.1

func (mc *MeteredCache) Get(dst, k []byte) []byte

func (*MeteredCache) GetBig added in v0.4.1

func (mc *MeteredCache) GetBig(dst, k []byte) []byte

func (*MeteredCache) Has added in v0.4.1

func (mc *MeteredCache) Has(k []byte) bool

func (*MeteredCache) HasGet added in v0.4.1

func (mc *MeteredCache) HasGet(dst, k []byte) ([]byte, bool)

func (*MeteredCache) Set added in v0.4.1

func (mc *MeteredCache) Set(k, v []byte)

func (*MeteredCache) SetBig added in v0.4.1

func (mc *MeteredCache) SetBig(k, v []byte)

Jump to

Keyboard shortcuts

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