cache

package
v0.0.0-...-765cc39 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const EagerlyLoadedBlocks = 200
View Source
const FinalityDepth = 7
View Source
const LastSeenKey = "lastseenblock"
View Source
const WarmUpConcurrency = 5

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeightWatcher

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

func NewBlockHeightWatcher

func NewBlockHeightWatcher(sw backend.Switcher) *BlockHeightWatcher

func (*BlockHeightWatcher) BlockHeight

func (b *BlockHeightWatcher) BlockHeight() uint64

func (*BlockHeightWatcher) IsFinalized

func (b *BlockHeightWatcher) IsFinalized(blockNum uint64) bool

func (*BlockHeightWatcher) Start

func (b *BlockHeightWatcher) Start() error

func (*BlockHeightWatcher) Stop

func (b *BlockHeightWatcher) Stop() error

func (*BlockHeightWatcher) Subscribe

func (b *BlockHeightWatcher) Subscribe(cb BlockSub) int

func (*BlockHeightWatcher) Unsubscribe

func (b *BlockHeightWatcher) Unsubscribe(hdl int)

type BlockSub

type BlockSub func(number uint64)

type CacheableMap

type CacheableMap map[string][]byte

type Cacher

type Cacher interface {
	pkg.Service
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	SetEx(key string, value []byte, expiration time.Duration) error
	Has(key string) (bool, error)
	MapGet(key string, field string) ([]byte, error)
	MapSetEx(key string, vals CacheableMap, expiration time.Duration) error
	Del(key string) error
}

type ETHStore

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

func NewETHStore

func NewETHStore(cacher Cacher, hWatcher *BlockHeightWatcher) *ETHStore

func (*ETHStore) CacheBalance

func (e *ETHStore) CacheBalance(address string, data []byte) error

func (*ETHStore) CacheBlockByNumber

func (e *ETHStore) CacheBlockByNumber(data []byte, includeBodies bool) error

func (*ETHStore) CacheTransactionReceipt

func (e *ETHStore) CacheTransactionReceipt(data []byte) error

func (*ETHStore) GetBalance

func (e *ETHStore) GetBalance(address string) ([]byte, error)

func (*ETHStore) GetBlockByNumber

func (e *ETHStore) GetBlockByNumber(number uint64, includeBodies bool) ([]byte, error)

func (*ETHStore) GetTransactionReceipt

func (e *ETHStore) GetTransactionReceipt(hash string) ([]byte, error)

type RedisCacher

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

func NewRedisCacher

func NewRedisCacher(cfg *config.RedisConfig) *RedisCacher

func (*RedisCacher) Del

func (r *RedisCacher) Del(key string) error

func (*RedisCacher) Get

func (r *RedisCacher) Get(key string) ([]byte, error)

func (*RedisCacher) Has

func (r *RedisCacher) Has(key string) (bool, error)

func (*RedisCacher) MapGet

func (r *RedisCacher) MapGet(key string, field string) ([]byte, error)

func (*RedisCacher) MapSetEx

func (r *RedisCacher) MapSetEx(key string, vals CacheableMap, expiration time.Duration) error

func (*RedisCacher) Set

func (r *RedisCacher) Set(key string, value []byte) error

func (*RedisCacher) SetEx

func (r *RedisCacher) SetEx(key string, value []byte, expiration time.Duration) error

func (*RedisCacher) Start

func (r *RedisCacher) Start() error

func (*RedisCacher) Stop

func (r *RedisCacher) Stop() error

type Warmer

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

func NewWarmer

func NewWarmer(store *ETHStore, cacher Cacher, hWatcher *BlockHeightWatcher, switcher backend.Switcher) *Warmer

func (*Warmer) Start

func (w *Warmer) Start() error

func (*Warmer) Stop

func (w *Warmer) Stop() error

Jump to

Keyboard shortcuts

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