Documentation ¶
Index ¶
- Constants
- type ChannelSubscriptionManager
- func (sm *ChannelSubscriptionManager) Channels() channels.ChannelList
- func (sm *ChannelSubscriptionManager) GetEngine(channel channels.Channel) (network.MessageProcessor, error)
- func (sm *ChannelSubscriptionManager) Register(channel channels.Channel, engine network.MessageProcessor) error
- func (sm *ChannelSubscriptionManager) Unregister(channel channels.Channel) error
- type RoleBasedFilter
Constants ¶
const UnstakedRole = flow.Role(0)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelSubscriptionManager ¶
type ChannelSubscriptionManager struct {
// contains filtered or unexported fields
}
ChannelSubscriptionManager manages subscriptions of engines running on the node to channels. Each channel should be taken by at most a single engine.
func NewChannelSubscriptionManager ¶
func NewChannelSubscriptionManager(underlay network.Underlay) *ChannelSubscriptionManager
NewChannelSubscriptionManager creates a new subscription manager. Args: - networkUnderlay: the Underlay interface of the network layer. Returns: - a new subscription manager.
func (*ChannelSubscriptionManager) Channels ¶
func (sm *ChannelSubscriptionManager) Channels() channels.ChannelList
Channels returns all the channels registered in this subscription manager.
func (*ChannelSubscriptionManager) GetEngine ¶
func (sm *ChannelSubscriptionManager) GetEngine(channel channels.Channel) (network.MessageProcessor, error)
GetEngine returns engine associated with a channel.
func (*ChannelSubscriptionManager) Register ¶
func (sm *ChannelSubscriptionManager) Register(channel channels.Channel, engine network.MessageProcessor) error
Register registers an engine on the channel into the subscription manager.
func (*ChannelSubscriptionManager) Unregister ¶
func (sm *ChannelSubscriptionManager) Unregister(channel channels.Channel) error
Unregister removes the engine associated with a channel.
type RoleBasedFilter ¶
type RoleBasedFilter struct {
// contains filtered or unexported fields
}
RoleBasedFilter implements a subscription filter that filters subscriptions based on a node's role.
func NewRoleBasedFilter ¶
func NewRoleBasedFilter(role flow.Role, idProvider module.IdentityProvider) *RoleBasedFilter
func (*RoleBasedFilter) CanSubscribe ¶
func (f *RoleBasedFilter) CanSubscribe(topic string) bool
func (*RoleBasedFilter) FilterIncomingSubscriptions ¶
func (f *RoleBasedFilter) FilterIncomingSubscriptions(from peer.ID, opts []*pb.RPC_SubOpts) ([]*pb.RPC_SubOpts, error)