Documentation ¶
Overview ¶
File: internal/subscription_manager/subscription_manager.go
Index ¶
- type SubscriptionManager
- func (sm *SubscriptionManager) BroadcastLog(eventKey internal.EventKey, log api.Log)
- func (sm *SubscriptionManager) Close()
- func (sm *SubscriptionManager) GetAddressesAndTopics() []internal.EventKey
- func (sm *SubscriptionManager) Subscribe(address common.Address, topic common.Hash) (chan api.Log, error)
- func (sm *SubscriptionManager) Unsubscribe(address common.Address, topic common.Hash, ch chan api.Log) error
- type SubscriptionManagerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SubscriptionManager ¶
type SubscriptionManager struct {
// contains filtered or unexported fields
}
SubscriptionManager manages subscriptions for a specific chain.
func NewSubscriptionManager ¶
func NewSubscriptionManager(cfg SubscriptionManagerConfig) *SubscriptionManager
NewSubscriptionManager initializes a new SubscriptionManager.
func (*SubscriptionManager) BroadcastLog ¶
func (sm *SubscriptionManager) BroadcastLog(eventKey internal.EventKey, log api.Log)
BroadcastLog sends the log event to all relevant subscribers.
func (*SubscriptionManager) Close ¶
func (sm *SubscriptionManager) Close()
Close gracefully shuts down the SubscriptionManager by closing all subscriber channels.
func (*SubscriptionManager) GetAddressesAndTopics ¶
func (sm *SubscriptionManager) GetAddressesAndTopics() []internal.EventKey
GetAddressesAndTopics retrieves all unique EventKeys. Implements caching: caches the result after the first call and invalidates it upon subscription changes. Returns a slice of EventKeys, each containing a unique address-topic pair.
func (*SubscriptionManager) Subscribe ¶
func (sm *SubscriptionManager) Subscribe(address common.Address, topic common.Hash) (chan api.Log, error)
Subscribe registers a new subscription and returns a channel for events.
func (*SubscriptionManager) Unsubscribe ¶
func (sm *SubscriptionManager) Unsubscribe(address common.Address, topic common.Hash, ch chan api.Log) error
Unsubscribe removes a subscription and closes the channel.