subscriptions

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

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)

Jump to

Keyboard shortcuts

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