redis

package
v1.3.3-testnet Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewRedisClient

func MustNewRedisClient(url string) *redis.Client

func ParseRedisNil

func ParseRedisNil(err error) error

func RedisKey

func RedisKey(keyParts ...string) string

RedisKey returns a unified redis key sperated by colon

func RedisRLPGet

func RedisRLPGet(ctx context.Context, rc redis.Cmdable, key string, pVal interface{}) error

Unmarshal RLP raw data read from redis by key key: redis key v: value for unmarshal, e.g. types.transaction, and use pointer type

func StrUint64

func StrUint64(v uint64) string

Types

type RedisStore

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

RedisStore aggregation store to cache block/txn/receipt data in Redis. Be noted this would be deprecated in the next few release due to chain data are usually oversized (with some of them even more than several MB). It is totally inefficient for Redis to cache big key under such circumstance.

func MustNewRedisStoreFromViper

func MustNewRedisStoreFromViper(disabler store.StoreDisabler) (*RedisStore, bool)

func (*RedisStore) Close

func (rs *RedisStore) Close() error

func (*RedisStore) DequeueBlocks

func (rs *RedisStore) DequeueBlocks(epochUntil uint64) error

func (*RedisStore) DequeueLogs

func (rs *RedisStore) DequeueLogs(epochUntil uint64) error

func (*RedisStore) DequeueTransactions

func (rs *RedisStore) DequeueTransactions(epochUntil uint64) error

func (*RedisStore) Flush

func (rs *RedisStore) Flush() error

func (*RedisStore) GetBlockByBlockNumber

func (rs *RedisStore) GetBlockByBlockNumber(ctx context.Context, blockNumber uint64) (*store.Block, error)

func (*RedisStore) GetBlockByEpoch

func (rs *RedisStore) GetBlockByEpoch(ctx context.Context, epochNumber uint64) (*store.Block, error)

func (*RedisStore) GetBlockByHash

func (rs *RedisStore) GetBlockByHash(ctx context.Context, blockHash types.Hash) (*store.Block, error)

func (*RedisStore) GetBlockEpochRange

func (rs *RedisStore) GetBlockEpochRange() (uint64, uint64, error)

func (*RedisStore) GetBlockSummaryByBlockNumber

func (rs *RedisStore) GetBlockSummaryByBlockNumber(ctx context.Context, blockNumber uint64) (*store.BlockSummary, error)

func (*RedisStore) GetBlockSummaryByEpoch

func (rs *RedisStore) GetBlockSummaryByEpoch(ctx context.Context, epochNumber uint64) (*store.BlockSummary, error)

func (*RedisStore) GetBlockSummaryByHash

func (rs *RedisStore) GetBlockSummaryByHash(ctx context.Context, blockHash types.Hash) (*store.BlockSummary, error)

func (*RedisStore) GetBlocksByEpoch

func (rs *RedisStore) GetBlocksByEpoch(ctx context.Context, epochNumber uint64) ([]types.Hash, error)

func (*RedisStore) GetGlobalEpochRange

func (rs *RedisStore) GetGlobalEpochRange() (uint64, uint64, error)

func (*RedisStore) GetLogEpochRange

func (rs *RedisStore) GetLogEpochRange() (uint64, uint64, error)

func (*RedisStore) GetLogs

func (rs *RedisStore) GetLogs(ctx context.Context, filter store.LogFilter) (logs []*store.Log, err error)

func (*RedisStore) GetNumBlocks

func (rs *RedisStore) GetNumBlocks() (uint64, error)

func (*RedisStore) GetNumLogs

func (rs *RedisStore) GetNumLogs() (uint64, error)

func (*RedisStore) GetNumTransactions

func (rs *RedisStore) GetNumTransactions() (uint64, error)

func (*RedisStore) GetReceipt

func (rs *RedisStore) GetReceipt(ctx context.Context, txHash types.Hash) (*store.TransactionReceipt, error)

func (*RedisStore) GetTransaction

func (rs *RedisStore) GetTransaction(ctx context.Context, txHash types.Hash) (*store.Transaction, error)

func (*RedisStore) GetTransactionEpochRange

func (rs *RedisStore) GetTransactionEpochRange() (uint64, uint64, error)

func (*RedisStore) IsRecordNotFound

func (rs *RedisStore) IsRecordNotFound(err error) bool

func (*RedisStore) LoadConfig

func (rs *RedisStore) LoadConfig(confNames ...string) (map[string]interface{}, error)

func (*RedisStore) Pop

func (rs *RedisStore) Pop() error

func (*RedisStore) Popn

func (rs *RedisStore) Popn(epochUntil uint64) error

Popn pops multiple epoch data from redis.

func (*RedisStore) Push

func (rs *RedisStore) Push(data *store.EpochData) error

func (*RedisStore) Pushn

func (rs *RedisStore) Pushn(dataSlice []*store.EpochData) error

func (*RedisStore) StoreConfig

func (rs *RedisStore) StoreConfig(confName string, confVal interface{}) error

type RedisStoreConfig

type RedisStoreConfig struct {
	Enabled   bool
	CacheTime time.Duration `default:"12h"`
	Url       string
}

Jump to

Keyboard shortcuts

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