Documentation ¶
Index ¶
- type CircularBuffer
- type LogKey
- type SubscriptionManager
- func (sm *SubscriptionManager) HandleNewSubscriptions(clients []rpc.Client, req *wecommon.RPCRequest, resp *interface{}, ...) error
- func (sm *SubscriptionManager) HandleUnsubscribe(userSubscriptionID string, rpcResp *interface{})
- func (sm *SubscriptionManager) UpdateSubscriptionMapping(userSubscriptionID string, subscription *gethrpc.ClientSubscription)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CircularBuffer ¶
type CircularBuffer struct {
// contains filtered or unexported fields
}
CircularBuffer is a data structure that uses a single, fixed-size buffer as if it was connected end-to-end.
func NewCircularBuffer ¶
func NewCircularBuffer(size int) *CircularBuffer
NewCircularBuffer initializes a new CircularBuffer of the given size.
func (*CircularBuffer) Contains ¶
func (cb *CircularBuffer) Contains(key LogKey) bool
Contains checks if the given LogKey exists in the buffer
func (*CircularBuffer) Push ¶
func (cb *CircularBuffer) Push(key LogKey)
Push adds a new LogKey to the end of the buffer. If the buffer is full, it overwrites the oldest data with the new LogKey.
type LogKey ¶
type LogKey struct { BlockHash common.Hash // Not necessary, but can be helpful in edge case of block reorg. TxHash common.Hash Index uint }
LogKey uniquely represents a log (consists of BlockHash, TxHash, and Index)
type SubscriptionManager ¶
type SubscriptionManager struct {
// contains filtered or unexported fields
}
func New ¶
func New(logger gethlog.Logger) *SubscriptionManager
func (*SubscriptionManager) HandleNewSubscriptions ¶
func (sm *SubscriptionManager) HandleNewSubscriptions(clients []rpc.Client, req *wecommon.RPCRequest, resp *interface{}, userConn userconn.UserConn) error
HandleNewSubscriptions subscribes to an event with all the clients provided. Doing this is necessary because we have relevancy rule, and we want to subscribe sometimes with all clients to get all the events
func (*SubscriptionManager) HandleUnsubscribe ¶
func (sm *SubscriptionManager) HandleUnsubscribe(userSubscriptionID string, rpcResp *interface{})
func (*SubscriptionManager) UpdateSubscriptionMapping ¶
func (sm *SubscriptionManager) UpdateSubscriptionMapping(userSubscriptionID string, subscription *gethrpc.ClientSubscription)