Versions in this module Expand all Collapse all v0 v0.1.0 Feb 14, 2020 Changes in this version + var ErrNoRows = errors.New("No rows matched in the database") + var ErrReadOnly = errors.New("Cannot modify read-only store") + var ErrTxConflict = errors.New("Transaction conflict") + var ErrTxInvalid = errors.New("Invalid transaction") + var ErrWatchServiceClosed = errors.New("Watch service closed") + var ErrWatcherTimeout = errors.New("Watcher timeout") + type BlockNumber interface + GetCurrentBlockNumber func() (*big.Int, error) + type BoundContract struct + func NewBoundContract(conn *ethclient.Client, addr ethcommon.Address, rawABI string) (*BoundContract, error) + func (c *BoundContract) CallFunc(result interface{}, method string, params ...interface{}) error + func (c *BoundContract) FilterEvent(name string, opts *bind.FilterOpts, event interface{}) (*EventIterator, error) + func (c *BoundContract) GetABI() string + func (c *BoundContract) GetAddr() ethcommon.Address + func (c *BoundContract) GetETHClient() *ethclient.Client + func (c *BoundContract) ParseEvent(name string, log ethtypes.Log, event interface{}) error + func (c *BoundContract) SendTransaction(auth *bind.TransactOpts, method string, params ...interface{}) (*ethtypes.Transaction, error) + func (c *BoundContract) WatchEvent(name string, opts *bind.WatchOpts, done <-chan bool) (ethtypes.Log, error) + type CallbackID uint64 + type Contract interface + CallFunc func(interface{}, string, ...interface{}) error + FilterEvent func(string, *bind.FilterOpts, interface{}) (*EventIterator, error) + GetABI func() string + GetAddr func() ethcommon.Address + GetETHClient func() *ethclient.Client + ParseEvent func(string, ethtypes.Log, interface{}) error + SendTransaction func(*bind.TransactOpts, string, ...interface{}) (*ethtypes.Transaction, error) + WatchEvent func(string, *bind.WatchOpts, <-chan bool) (ethtypes.Log, error) + type DAL struct + func NewDAL(store KVStore) *DAL + func (d *DAL) DeleteLogEventWatch(name string) error + func (d *DAL) GetAllLogEventWatchKeys() ([]string, error) + func (d *DAL) GetLogEventWatch(name string) (*LogEventID, error) + func (d *DAL) HasLogEventWatch(name string) (bool, error) + func (d *DAL) PutLogEventWatch(name string, id *LogEventID) error + type Deadline struct + BlockNum *big.Int + Callback func() + type DeadlineQueue []*big.Int + func (dq *DeadlineQueue) Pop() (popped interface{}) + func (dq *DeadlineQueue) Push(x interface{}) + func (dq *DeadlineQueue) Top() (top interface{}) + func (dq DeadlineQueue) Len() int + func (dq DeadlineQueue) Less(i, j int) bool + func (dq DeadlineQueue) Swap(i, j int) + type Event struct + Addr ethcommon.Address + BlockDelay uint64 + Callback func(CallbackID, ethtypes.Log) + EndBlock *big.Int + Name string + RawAbi string + StartBlock *big.Int + WatchName string + type EventIterator struct + Contract *BoundContract + Done bool + Event interface{} + Fail error + Logs chan ethtypes.Log + Name string + Sub ethereum.Subscription + func (it *EventIterator) Close() error + func (it *EventIterator) Error() error + func (it *EventIterator) Next() (ethtypes.Log, bool) + type KVStore interface + Close func() + Delete func(table, key string) error + Get func(table, key string, value interface{}) error + GetKeysByPrefix func(table, prefix string) ([]string, error) + Has func(table, key string) (bool, error) + OpenTransaction func() (Transaction, error) + Put func(table, key string, value interface{}) error + type KVStoreLocal struct + func NewKVStoreLocal(rootDir string, readOnly bool) (*KVStoreLocal, error) + func (s *KVStoreLocal) Close() + func (s *KVStoreLocal) Delete(table, key string) error + func (s *KVStoreLocal) Get(table, key string, value interface{}) error + func (s *KVStoreLocal) GetKeysByPrefix(table, prefix string) ([]string, error) + func (s *KVStoreLocal) Has(table, key string) (bool, error) + func (s *KVStoreLocal) OpenTransaction() (Transaction, error) + func (s *KVStoreLocal) Put(table, key string, value interface{}) error + type LogEventID struct + BlockNumber uint64 + Index int64 + type Service struct + func NewService(watch *WatchService, blockDelay uint64, enabled bool, rpcAddr string) *Service + func (s *Service) Close() + func (s *Service) GetCurrentBlockNumber() *big.Int + func (s *Service) Init() + func (s *Service) Monitor(eventName string, contract Contract, startBlock *big.Int, endBlock *big.Int, ...) (CallbackID, error) + func (s *Service) MonitorEvent(e Event, reset bool) (CallbackID, error) + func (s *Service) RegisterDeadline(d Deadline) CallbackID + func (s *Service) RemoveDeadline(id CallbackID) + func (s *Service) RemoveEvent(id CallbackID) + type Storage interface + Delete func(table, key string) error + Get func(table, key string, value interface{}) error + GetKeysByPrefix func(table, prefix string) ([]string, error) + Has func(table, key string) (bool, error) + Put func(table, key string, value interface{}) error + type Transaction interface + Commit func() error + ConvertError func(err error) error + Delete func(table, key string) error + Discard func() + Get func(table, key string, value interface{}) error + GetKeysByPrefix func(table, prefix string) ([]string, error) + Has func(table, key string) (bool, error) + Put func(table, key string, value interface{}) error + type TransactionLocal struct + func (tx *TransactionLocal) Commit() error + func (tx *TransactionLocal) ConvertError(err error) error + func (tx *TransactionLocal) Delete(table, key string) error + func (tx *TransactionLocal) Discard() + func (tx *TransactionLocal) Get(table, key string, value interface{}) error + func (tx *TransactionLocal) GetKeysByPrefix(table, prefix string) ([]string, error) + func (tx *TransactionLocal) Has(table, key string) (bool, error) + func (tx *TransactionLocal) Put(table, key string, value interface{}) error + type Watch struct + func (w *Watch) Ack() error + func (w *Watch) Close() + func (w *Watch) Next() (types.Log, error) + type WatchClient interface + FilterLogs func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) + HeaderByNumber func(ctx context.Context, number *big.Int) (*types.Header, error) + type WatchDAL interface + DeleteLogEventWatch func(name string) error + GetAllLogEventWatchKeys func() ([]string, error) + GetLogEventWatch func(name string) (*LogEventID, error) + HasLogEventWatch func(name string) (bool, error) + PutLogEventWatch func(name string, id *LogEventID) error + type WatchService struct + func NewWatchService(client WatchClient, dal WatchDAL, polling uint64) *WatchService + func (ws *WatchService) Close() + func (ws *WatchService) GetBlockNumber() uint64 + func (ws *WatchService) GetCurrentBlockNumber() *big.Int + func (ws *WatchService) MakeFilterQuery(addr ethcommon.Address, rawABI string, eventName string, startBlock *big.Int) (ethereum.FilterQuery, error) + func (ws *WatchService) NewWatch(name string, query ethereum.FilterQuery, blkDelay, blkInterval uint64, ...) (*Watch, error)