cache

package
v1.0.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cache contains critical caches necessary for the runtime of the slasher service, being able to keep attestation spans by epoch for the validators active in the beacon chain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EpochSpansCache

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

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

func NewEpochSpansCache

func NewEpochSpansCache(size int, onEvicted func(key interface{}, value interface{})) (*EpochSpansCache, error)

NewEpochSpansCache initializes the map and underlying cache.

func (*EpochSpansCache) Clear

func (c *EpochSpansCache) Clear()

Clear removes all keys from the SpanCache.

func (*EpochSpansCache) Delete

func (c *EpochSpansCache) Delete(epoch uint64) bool

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

func (*EpochSpansCache) Get

func (c *EpochSpansCache) Get(epoch uint64) (map[uint64]types.Span, bool)

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

func (*EpochSpansCache) Has

func (c *EpochSpansCache) Has(epoch uint64) bool

Has returns true if the key exists in the cache.

func (*EpochSpansCache) Set

func (c *EpochSpansCache) Set(epoch uint64, epochSpans map[uint64]types.Span)

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(validatorIdx uint64) 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(validatorIdx uint64) ([]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(validatorIdx uint64) bool

Has returns true if the key exists in the cache.

func (*PublicKeyCache) Set added in v0.3.10

func (c *PublicKeyCache) Set(validatorIdx uint64, 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