Documentation
¶
Index ¶
- func GetQueryHash(chainId *big.Int, query ethereum.FilterQuery) common.Hash
- func GetQueryKey(chainId *big.Int, query ethereum.FilterQuery) string
- type ChainSubscriber
- func (cs *ChainSubscriber) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error)
- func (cs *ChainSubscriber) FilterLogsWithChannel(ctx context.Context, q ethereum.FilterQuery, logsChan chan<- types.Log, ...) (err error)
- func (cs *ChainSubscriber) GetBlockConfirmationsOnSubscription() uint64
- func (cs *ChainSubscriber) SetBlockConfirmationsOnSubscription(confirmations uint64)
- func (cs *ChainSubscriber) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (sub ethereum.Subscription, err error)
- func (cs *ChainSubscriber) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (sub ethereum.Subscription, err error)
- type MemoryStorage
- func (s *MemoryStorage) LatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery) (uint64, error)
- func (s *MemoryStorage) LatestLogForQuery(ctx context.Context, query ethereum.FilterQuery) (types.Log, error)
- func (s *MemoryStorage) SaveLatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery, blockNum uint64) error
- func (s *MemoryStorage) SaveLatestLogForQuery(ctx context.Context, query ethereum.FilterQuery, log types.Log) error
- type RedisStorage
- func (s *RedisStorage) LatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery) (uint64, error)
- func (s *RedisStorage) LatestLogForQuery(ctx context.Context, query ethereum.FilterQuery) (types.Log, error)
- func (s *RedisStorage) QueryLock(q ethereum.FilterQuery) sync.Locker
- func (s *RedisStorage) SaveLatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery, blockNum uint64) error
- func (s *RedisStorage) SaveLatestLogForQuery(ctx context.Context, query ethereum.FilterQuery, log types.Log) error
- type Subscriber
- type SubscriberStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetQueryHash ¶ added in v0.0.2
func GetQueryKey ¶
Types ¶
type ChainSubscriber ¶
type ChainSubscriber struct {
// contains filtered or unexported fields
}
ChainSubscriber implements Subscriber interface
func NewChainSubscriber ¶
func NewChainSubscriber(c *ethclient.Client, storage SubscriberStorage) (*ChainSubscriber, error)
NewChainSubscriber .
func (*ChainSubscriber) FilterLogs ¶
func (*ChainSubscriber) FilterLogsWithChannel ¶
func (*ChainSubscriber) GetBlockConfirmationsOnSubscription ¶ added in v0.0.2
func (cs *ChainSubscriber) GetBlockConfirmationsOnSubscription() uint64
func (*ChainSubscriber) SetBlockConfirmationsOnSubscription ¶ added in v0.0.2
func (cs *ChainSubscriber) SetBlockConfirmationsOnSubscription(confirmations uint64)
func (*ChainSubscriber) SubscribeFilterLogs ¶
func (*ChainSubscriber) SubscribeNewHead ¶
func (cs *ChainSubscriber) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (sub ethereum.Subscription, err error)
SubscribeNewHead .
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
func NewMemoryStorage ¶
func NewMemoryStorage(chainId *big.Int) *MemoryStorage
func (*MemoryStorage) LatestBlockForQuery ¶
func (s *MemoryStorage) LatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery) (uint64, error)
func (*MemoryStorage) LatestLogForQuery ¶
func (*MemoryStorage) SaveLatestBlockForQuery ¶
func (s *MemoryStorage) SaveLatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery, blockNum uint64) error
func (*MemoryStorage) SaveLatestLogForQuery ¶
type RedisStorage ¶
type RedisStorage struct {
// contains filtered or unexported fields
}
func NewRedisStorage ¶
func NewRedisStorage(chainId *big.Int, pool redis.Pool) *RedisStorage
func (*RedisStorage) LatestBlockForQuery ¶
func (s *RedisStorage) LatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery) (uint64, error)
func (*RedisStorage) LatestLogForQuery ¶
func (*RedisStorage) QueryLock ¶
func (s *RedisStorage) QueryLock(q ethereum.FilterQuery) sync.Locker
func (*RedisStorage) SaveLatestBlockForQuery ¶
func (s *RedisStorage) SaveLatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery, blockNum uint64) error
func (*RedisStorage) SaveLatestLogForQuery ¶
type Subscriber ¶
type Subscriber interface { GetBlockConfirmationsOnSubscription() uint64 SetBlockConfirmationsOnSubscription(confirmations uint64) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) FilterLogs(ctx context.Context, q ethereum.FilterQuery) (logs []types.Log, err error) }
Subscriber represents a set of methods about chain subscription
type SubscriberStorage ¶
type SubscriberStorage interface { LatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery) (uint64, error) LatestLogForQuery(ctx context.Context, query ethereum.FilterQuery) (types.Log, error) SaveLatestBlockForQuery(ctx context.Context, query ethereum.FilterQuery, blockNum uint64) error SaveLatestLogForQuery(ctx context.Context, query ethereum.FilterQuery, log types.Log) error }
Used only for function `SubscribeFilterlogs` and query.ToBlock == nil
Click to show internal directories.
Click to hide internal directories.