level

package
v0.0.0-...-1bcd00c Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	RedisClient *redis.Client
	LevelDb     dbm.DB
	Logger      log.Logger
}

func NewCache

func NewCache(redis *redis.Client, db *dbm.DB, logger log.Logger) *Cache

create redis caching layer that gradually migrates to leveldb

func (*Cache) Add

func (cache *Cache) Add(key string, value string) error

func (*Cache) BulkInsertAggState

func (cache *Cache) BulkInsertAggState(aggStates []types.AggState) error

BulkInsertAggState : inserts aggregator state into postgres

func (*Cache) BulkInsertBtcAggState

func (cache *Cache) BulkInsertBtcAggState(aggStates []types.AnchorBtcAggState) error

BulkInsertBtcAggState : inserts aggregator state into postgres

func (*Cache) BulkInsertBtcTxState

func (cache *Cache) BulkInsertBtcTxState(txStates []types.AnchorBtcTxState) error

BulkInsertBtcTxState : inserts aggregator state into postgres

func (*Cache) BulkInsertCalState

func (cache *Cache) BulkInsertCalState(calStates []types.CalStateObject) error

BulkInsertCalState : inserts aggregator state into postgres

func (*Cache) BulkInsertProofs

func (cache *Cache) BulkInsertProofs(proofs []types.ProofState) error

BulkInsertProofs : Use pg driver and loop to create bulk proof insert statement

func (*Cache) Del

func (cache *Cache) Del(key string, value string) error

func (*Cache) Get

func (cache *Cache) Get(key string) ([]string, error)

func (*Cache) GetAggStateObjectsByProofIds

func (cache *Cache) GetAggStateObjectsByProofIds(proofIds []string) ([]types.AggState, error)

GetAggStateObjectsByProofIds : Get aggstate objects, given an array of proofIds

func (*Cache) GetAnchorBTCAggStateObjectsByCalIds

func (cache *Cache) GetAnchorBTCAggStateObjectsByCalIds(calIds []string) ([]types.AnchorBtcAggState, error)

GetAnchorBTCAggStateObjectsByCalIds: Get anchor state objects, given an array of calIds

func (*Cache) GetBTCTxStateObjectByAnchorBTCAggId

func (cache *Cache) GetBTCTxStateObjectByAnchorBTCAggId(aggId string) (types.AnchorBtcTxState, error)

GetBTCTxStateObjectByAnchorBTCAggId: Get btc state objects, given an array of agg ids

func (*Cache) GetCalStateObjectsByAggIds

func (cache *Cache) GetCalStateObjectsByAggIds(aggIds []string) ([]types.CalStateObject, error)

GetCalStateObjectsByProofIds : Get calstate objects, given an array of aggIds

func (*Cache) GetOne

func (cache *Cache) GetOne(key string) (string, error)

func (*Cache) GetProofIdsByAggIds

func (cache *Cache) GetProofIdsByAggIds(aggIds []string) ([]string, error)

GetProofIdsByAggIds : get proof ids from agg table, based on aggId

func (*Cache) GetProofIdsByBtcTxId

func (cache *Cache) GetProofIdsByBtcTxId(btcTxId string) ([]string, error)

GetProofIdsByBtcTxId : get proof ids from proof table, based on btctxId

func (*Cache) GetProofsByProofIds

func (cache *Cache) GetProofsByProofIds(proofIds []string) (map[string]types.ProofState, error)

GetProofsByProofIds : get proofs from proof table, based on id

func (*Cache) PruneOldState

func (cache *Cache) PruneOldState()

func (*Cache) Set

func (cache *Cache) Set(key string, value string) error

func (*Cache) SetArray

func (cache *Cache) SetArray(key string, values []string) error

Jump to

Keyboard shortcuts

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