sets

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnGaterSet

type ConnGaterSet struct {
	// contains filtered or unexported fields
}

ConnGaterSet implements the connmgr.ConnectionGater and allow to aggregate multiple instances of this interface.

func NewConnGaterSet

func NewConnGaterSet() *ConnGaterSet

NewConnGaterSet creates new instance of the ConnGaterSet.

func (*ConnGaterSet) Add

func (c *ConnGaterSet) Add(connGaters ...connmgr.ConnectionGater)

Add adds new connmgr.ConnectionGater to the set.

func (*ConnGaterSet) InterceptAccept

func (c *ConnGaterSet) InterceptAccept(network network.ConnMultiaddrs) bool

InterceptAccept implements the connmgr.ConnectionGater interface.

func (*ConnGaterSet) InterceptAddrDial

func (c *ConnGaterSet) InterceptAddrDial(id peer.ID, addr multiaddr.Multiaddr) bool

InterceptAddrDial implements the connmgr.ConnectionGater interface.

func (*ConnGaterSet) InterceptPeerDial

func (c *ConnGaterSet) InterceptPeerDial(id peer.ID) bool

InterceptPeerDial implements the connmgr.ConnectionGater interface.

func (*ConnGaterSet) InterceptSecured

func (c *ConnGaterSet) InterceptSecured(dir network.Direction, id peer.ID, network network.ConnMultiaddrs) bool

InterceptSecured implements the connmgr.ConnectionGater interface.

func (*ConnGaterSet) InterceptUpgraded

func (c *ConnGaterSet) InterceptUpgraded(conn network.Conn) (bool, control.DisconnectReason)

InterceptUpgraded implements the connmgr.ConnectionGater interface.

type MessageHandler

type MessageHandler interface {
	// Published is called when new message is published.
	Published(topic string, msg []byte)
	// Received is called when new message is received.
	Received(topic string, msg *pubsub.Message, result pubsub.ValidationResult)
}

MessageHandler can ba implemented by type that supports handling the PubSub system messages.

type MessageHandlerSet

type MessageHandlerSet struct {
	// contains filtered or unexported fields
}

MessageHandlerSet stores multiple instances of the MessageHandler interface.

func NewMessageHandlerSet

func NewMessageHandlerSet() *MessageHandlerSet

NewMessageHandlerSet creates new instance of the MessageHandlerSet.

func (*MessageHandlerSet) Add

func (n *MessageHandlerSet) Add(messageHandler ...MessageHandler)

Add adds new MessageHandler to the set.

func (*MessageHandlerSet) Published

func (n *MessageHandlerSet) Published(topic string, msg []byte)

Published invokes all registered handlers.

func (*MessageHandlerSet) Received

func (n *MessageHandlerSet) Received(topic string, msg *pubsub.Message, result pubsub.ValidationResult)

Received invokes all registered handlers.

type NodeConfiguredEvent

type NodeConfiguredEvent struct{}

type NodeEventHandler

type NodeEventHandler interface {
	// Handle is called on a new event.
	Handle(event interface{})
}

NodeEventHandler can ba implemented by type that supports handling the Node system events.

type NodeEventHandlerFunc

type NodeEventHandlerFunc func(event interface{})

NodeEventHandlerFunc is a adapter for the NodeEventHandler interface.

func (NodeEventHandlerFunc) Handle

func (f NodeEventHandlerFunc) Handle(event interface{})

Handle calls f(topic, event).

type NodeEventHandlerSet

type NodeEventHandlerSet struct {
	// contains filtered or unexported fields
}

NodeEventHandlerSet stores multiple instances of the NodeEventHandler interface.

func NewNodeEventHandlerSet

func NewNodeEventHandlerSet() *NodeEventHandlerSet

NewNodeEventHandlerSet creates new instance of the NodeEventHandlerSet.

func (*NodeEventHandlerSet) Add

func (n *NodeEventHandlerSet) Add(eventHandler ...NodeEventHandler)

Add adds new NodeEventHandler to the set.

func (*NodeEventHandlerSet) Handle

func (n *NodeEventHandlerSet) Handle(event interface{})

Handle invokes all registered handlers for given topic.

type NodeHostStartedEvent

type NodeHostStartedEvent struct{}

type NodePubSubStartedEvent

type NodePubSubStartedEvent struct{}

type NodeStartedEvent

type NodeStartedEvent struct{}

type NodeStartingEvent

type NodeStartingEvent struct{}

type NodeStoppedEvent

type NodeStoppedEvent struct{}

type NodeStoppingEvent

type NodeStoppingEvent struct{}

type NodeTopicSubscribedEvent

type NodeTopicSubscribedEvent struct{ Topic string }

type NodeTopicUnsubscribedEvent

type NodeTopicUnsubscribedEvent struct{ Topic string }

type NotifeeSet

type NotifeeSet struct {
	// contains filtered or unexported fields
}

NotifeeSet implements the network.Notifiee and allow to aggregate multiple instances of this interface.

func NewNotifeeSet

func NewNotifeeSet() *NotifeeSet

NewNotifeeSet creates new instance of the NotifeeSet.

func (*NotifeeSet) Add

func (n *NotifeeSet) Add(notifees ...network.Notifiee)

Add adds new network.Notifiee to the set.

func (*NotifeeSet) Connected

func (n *NotifeeSet) Connected(network network.Network, conn network.Conn)

Connected implements the network.Notifiee interface.

func (*NotifeeSet) Disconnected

func (n *NotifeeSet) Disconnected(network network.Network, conn network.Conn)

Disconnected implements the network.Notifiee interface.

func (*NotifeeSet) Listen

func (n *NotifeeSet) Listen(network network.Network, maddr multiaddr.Multiaddr)

Listen implements the network.Notifiee interface.

func (*NotifeeSet) ListenClose

func (n *NotifeeSet) ListenClose(network network.Network, maddr multiaddr.Multiaddr)

ListenClose implements the network.Notifiee interface.

func (*NotifeeSet) Remove

func (n *NotifeeSet) Remove(notifees ...network.Notifiee)

Remove removes network.Notifiee from the set if already added.

type PubSubEventHandler

type PubSubEventHandler interface {
	// Handle is called on a new event.
	Handle(topic string, event pubsub.PeerEvent)
}

PubSubEventHandler can ba implemented by type that supports handling the PubSub system events.

type PubSubEventHandlerFunc

type PubSubEventHandlerFunc func(topic string, event pubsub.PeerEvent)

PubSubEventHandlerFunc is a adapter for the PubSubEventHandler interface.

func (PubSubEventHandlerFunc) Handle

func (f PubSubEventHandlerFunc) Handle(topic string, event pubsub.PeerEvent)

Handle calls f(topic, event).

type PubSubEventHandlerSet

type PubSubEventHandlerSet struct {
	// contains filtered or unexported fields
}

PubSubEventHandlerSet stores multiple instances of the PubSubEventHandler interface.

func NewPubSubEventHandlerSet

func NewPubSubEventHandlerSet() *PubSubEventHandlerSet

NewPubSubEventHandlerSet creates new instance of the PubSubEventHandlerSet.

func (*PubSubEventHandlerSet) Add

func (n *PubSubEventHandlerSet) Add(eventHandler ...PubSubEventHandler)

Add adds new PubSubEventHandler to the set.

func (*PubSubEventHandlerSet) Handle

func (n *PubSubEventHandlerSet) Handle(topic string, event pubsub.PeerEvent)

Handle invokes all registered handlers for given topic.

type Validator

type Validator func(ctx context.Context, topic string, id peer.ID, msg *pubsub.Message) pubsub.ValidationResult

type ValidatorSet

type ValidatorSet struct {
	// contains filtered or unexported fields
}

ValidatorSet stores multiple instances of validators that implements the pubsub.ValidatorEx functions. Validators are groped by topic.

func NewValidatorSet

func NewValidatorSet() *ValidatorSet

NewValidatorSet creates new instance of the ValidatorSet.

func (*ValidatorSet) Add

func (n *ValidatorSet) Add(validator ...Validator)

Add adds new pubsub.ValidatorEx to the set.

func (*ValidatorSet) Validator

func (n *ValidatorSet) Validator(topic string) pubsub.ValidatorEx

Validator returns function that implements pubsub.ValidatorEx. That function will invoke all registered validators for given topic.

Jump to

Keyboard shortcuts

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