cache

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: GPL-3.0 Imports: 7 Imported by: 12

Documentation

Overview

Package cache contains critical caches necessary for the runtime of the slasher service, such as a cache for maintaining validator history on a per epoch basis

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpochFlatSpansCache added in v1.0.0

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

EpochFlatSpansCache is used to store the spans needed on a per-epoch basis for slashing detection.

func NewEpochFlatSpansCache added in v1.0.0

func NewEpochFlatSpansCache(size int, onEvicted func(key interface{}, value interface{})) (*EpochFlatSpansCache, error)

NewEpochFlatSpansCache initializes the underlying cache with the given size and on evict function.

func (*EpochFlatSpansCache) Delete added in v1.0.0

func (c *EpochFlatSpansCache) Delete(epoch types.Epoch) bool

Delete removes an epoch from the cache and returns if it existed or not. Performs the onEviction function before removal.

func (*EpochFlatSpansCache) Get added in v1.0.0

Get returns an ok bool and the cached value for the requested epoch key, if any.

func (*EpochFlatSpansCache) Has added in v1.0.0

func (c *EpochFlatSpansCache) Has(epoch types.Epoch) bool

Has returns true if the key exists in the cache.

func (*EpochFlatSpansCache) Length added in v1.0.0

func (c *EpochFlatSpansCache) Length() int

Length returns the number of cached items.

func (*EpochFlatSpansCache) PruneOldest added in v1.0.0

func (c *EpochFlatSpansCache) PruneOldest() uint64

PruneOldest removes the oldest key from the span cache, calling its OnEvict function.

func (*EpochFlatSpansCache) Purge added in v1.0.0

func (c *EpochFlatSpansCache) Purge()

Purge removes all keys from the SpanCache and evicts all current data.

func (*EpochFlatSpansCache) Set added in v1.0.0

func (c *EpochFlatSpansCache) Set(epoch types.Epoch, epochSpans *slashertypes.EpochStore)

Set the response in the cache.

type HighestAttestationCache added in v1.0.0

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

HighestAttestationCache is used to store per validator id highest attestation in cache.

func NewHighestAttestationCache added in v1.0.0

func NewHighestAttestationCache(size int, onEvicted func(key interface{}, value interface{})) (*HighestAttestationCache, error)

NewHighestAttestationCache initializes the cache.

func (*HighestAttestationCache) Clear added in v1.0.0

func (c *HighestAttestationCache) Clear()

Clear removes all keys from the ValidatorCache.

func (*HighestAttestationCache) Delete added in v1.0.0

func (c *HighestAttestationCache) Delete(setKey uint64) bool

Delete removes a validator id from the cache and returns if it existed or not. Performs the onEviction function before removal.

func (*HighestAttestationCache) Get added in v1.0.0

Get returns an ok bool and the cached value for the requested validator id key, if any.

func (*HighestAttestationCache) Has added in v1.0.0

func (c *HighestAttestationCache) Has(setKey uint64) bool

Has returns true if the key exists in the cache.

func (*HighestAttestationCache) Purge added in v1.0.0

func (c *HighestAttestationCache) Purge()

Purge removes all keys from cache and evicts all current data.

func (*HighestAttestationCache) Set added in v1.0.0

func (c *HighestAttestationCache) Set(setKey uint64, highest *slashpb.HighestAttestation)

Set the response in the cache.

type PublicKeyCache added in v0.3.10

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

PublicKeyCache is used to store the public keys needed for signature verification.

func NewPublicKeyCache added in v0.3.10

func NewPublicKeyCache(size int, onEvicted func(key interface{}, value interface{})) (*PublicKeyCache, error)

NewPublicKeyCache initializes the cache.

func (*PublicKeyCache) Clear added in v0.3.10

func (c *PublicKeyCache) Clear()

Clear removes all keys from the ValidatorCache.

func (*PublicKeyCache) Delete added in v0.3.10

func (c *PublicKeyCache) Delete(validatorIndex types.ValidatorIndex) bool

Delete removes a validator id from the cache and returns if it existed or not. Performs the onEviction function before removal.

func (*PublicKeyCache) Get added in v0.3.10

func (c *PublicKeyCache) Get(validatorIndex types.ValidatorIndex) ([]byte, bool)

Get returns an ok bool and the cached value for the requested validator id key, if any.

func (*PublicKeyCache) Has added in v0.3.10

func (c *PublicKeyCache) Has(validatorIndex types.ValidatorIndex) bool

Has returns true if the key exists in the cache.

func (*PublicKeyCache) Set added in v0.3.10

func (c *PublicKeyCache) Set(validatorIndex types.ValidatorIndex, publicKey []byte)

Set the response in the cache.

Jump to

Keyboard shortcuts

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