Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

    Conn represents an incoming connection.

    func (c *Conn) AddLink(alias string, channel *security.Channel)

      AddLink adds a link alias for a channel.

      func (*Conn) CanSubscribe

      func (c *Conn) CanSubscribe(ssid message.Ssid, channel []byte) bool

        CanSubscribe increments the internal counters and checks if the cluster needs to be notified.

        func (*Conn) CanUnsubscribe

        func (c *Conn) CanUnsubscribe(ssid message.Ssid, channel []byte) bool

          CanUnsubscribe decrements the internal counters and checks if the cluster needs to be notified.

          func (*Conn) Close

          func (c *Conn) Close() error

            Close terminates the connection.

            func (*Conn) Decrement

            func (c *Conn) Decrement(ssid message.Ssid) bool

              Decrement decrements a subscription counter.

              func (c *Conn) GetLink(topic []byte) []byte

                GetLink checks if the topic is a registered shortcut and expands it.

                func (*Conn) ID

                func (c *Conn) ID() string

                  ID returns the unique identifier of the subsriber.

                  func (*Conn) Increment

                  func (c *Conn) Increment(ssid message.Ssid, channel []byte) bool

                    Increment increments the subscription counter.

                    func (c *Conn) Links() map[string]string

                      Links returns a map of all links registered.

                      func (*Conn) LocalID

                      func (c *Conn) LocalID() security.ID

                        LocalID returns the local connection identifier.

                        func (*Conn) MeasureElapsed

                        func (c *Conn) MeasureElapsed(name string, since time.Time)

                          MeasureElapsed measures elapsed time since

                          func (*Conn) Process

                          func (c *Conn) Process() error

                            Process processes the messages.

                            func (*Conn) Send

                            func (c *Conn) Send(m *message.Message) (err error)

                              Send forwards the message to the underlying client.

                              func (*Conn) Track

                              func (c *Conn) Track(contract contract.Contract)

                                Track tracks the connection by adding it to the metering.

                                func (*Conn) Type

                                func (c *Conn) Type() message.SubscriberType

                                  Type returns the type of the subscriber

                                  func (*Conn) Username

                                  func (c *Conn) Username() string

                                    Username returns the associated username.

                                    type Service

                                    type Service struct {
                                    	License license.License // The licence for this emitter server.
                                    	Config  *config.Config  // The configuration for the service.
                                    	// contains filtered or unexported fields
                                    }

                                      Service represents the main structure.

                                      func NewService

                                      func NewService(ctx context.Context, cfg *config.Config) (s *Service, err error)

                                        NewService creates a new service.

                                        func (*Service) Authorize

                                        func (s *Service) Authorize(channel *security.Channel, permission uint8) (contract.Contract, security.Key, bool)

                                          Authorize attempts to authorize a channel with its key

                                          func (*Service) Close

                                          func (s *Service) Close()

                                            Close closes gracefully the service.,

                                            func (*Service) ID

                                            func (s *Service) ID() uint64

                                              ID returns the local node ID.

                                              func (*Service) Join

                                              func (s *Service) Join(peers ...string) []error

                                                Join attempts to join a set of existing peers.

                                                func (*Service) Listen

                                                func (s *Service) Listen() (err error)

                                                  Listen starts the service.

                                                  func (*Service) NotifySubscribe

                                                  func (s *Service) NotifySubscribe(sub message.Subscriber, ev *event.Subscription)

                                                    NotifySubscribe notifies the swarm when a subscription occurs.

                                                    func (*Service) NotifyUnsubscribe

                                                    func (s *Service) NotifyUnsubscribe(sub message.Subscriber, ev *event.Subscription)

                                                      NotifyUnsubscribe notifies the swarm when an unsubscription occurs.

                                                      func (*Service) NumPeers

                                                      func (s *Service) NumPeers() int

                                                        NumPeers returns the number of peers of this service.

                                                        func (*Service) Query

                                                        func (s *Service) Query(query string, payload []byte) (message.Awaiter, error)

                                                          Query is a mechanism where a message from one node is broadcasted to the entire cluster and each node in the group responds to the message.