redis_helper

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close disconnect redis instance in tikv mode

func Init

func Init(serverAddr []string) error

Init used to init redis instance in tikv mode

func PublishNewFilterLogEvent added in v0.1.26

func PublishNewFilterLogEvent(shardID uint32, namespace, id string, crit ethereum.FilterQuery) error

PublishNewFilterLogEvent publish new filter log event from other readers

func PublishShardUpdate

func PublishShardUpdate(shardID uint32, blkNum uint64, logs []*types.Log) error

PublishShardUpdate publish block update event

func PublishTxPoolUpdate

func PublishTxPoolUpdate(shardID uint32, tx types.PoolTransaction, local bool) error

PublishTxPoolUpdate publish tx pool update event

func SubscribeNewFilterLogEvent added in v0.1.26

func SubscribeNewFilterLogEvent(shardID uint32, namespace string, cb func(id string, crit ethereum.FilterQuery))

SubscribeNewFilterLogEvent subscribe new filter log event from other readers

func SubscribeShardUpdate

func SubscribeShardUpdate(shardID uint32, cb func(blkNum uint64, logs []*types.Log))

SubscribeShardUpdate subscribe block update event

func SubscribeTxPoolUpdate

func SubscribeTxPoolUpdate(shardID uint32, cb func(tx types.PoolTransaction, local bool))

SubscribeTxPoolUpdate subscribe tx pool update event

Types

type BlockUpdate

type BlockUpdate struct {
	BlkNum uint64
	Logs   []*types.LogForStorage // types.Log will cut some fields when rpl encoding/decoding look at core/types/log.go:83
}

BlockUpdate block update event

type LockResult added in v0.1.14

type LockResult int
const (
	LockResultSuccess LockResult
	LockResultRenewalSuccess
	LockResultFail
)

type NewFilterUpdated added in v0.1.26

type NewFilterUpdated struct {
	ID             string
	FilterCriteria ethereum.FilterQuery
}

NewFilterUpdated new filter update event

type RedisPreempt

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

func CreatePreempt

func CreatePreempt(key string) *RedisPreempt

CreatePreempt used to create a redis preempt instance

func (*RedisPreempt) LastLockStatus

func (p *RedisPreempt) LastLockStatus() bool

LastLockStatus get the last preempt status

func (*RedisPreempt) TryLock

func (p *RedisPreempt) TryLock(ttlSecond int) (result LockResult, err error)

TryLock attempt to lock the master for ttlSecond

func (*RedisPreempt) Unlock

func (p *RedisPreempt) Unlock() (bool, error)

Unlock try to release the master permission

type TxPoolUpdate

type TxPoolUpdate struct {
	Local bool
	Tx    types.PoolTransaction
	// contains filtered or unexported fields
}

TxPoolUpdate tx pool update event

func (*TxPoolUpdate) DecodeRLP

func (t *TxPoolUpdate) DecodeRLP(stream *rlp.Stream) error

DecodeRLP decode struct from binary stream

func (*TxPoolUpdate) EncodeRLP

func (t *TxPoolUpdate) EncodeRLP(w io.Writer) error

EncodeRLP encode struct to binary stream

Jump to

Keyboard shortcuts

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