component

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrComponentNotFound = errors.New("component: not found")

ErrComponentNotFound will be returned by ProcessStanza in case the receiver component is not registered.

Functions

This section is empty.

Types

type Component

type Component interface {
	// Host returns component host address.
	Host() string

	// Name returns component name.
	Name() string

	// ProcessStanza will be called in case stanza is requested to processed by this component.
	ProcessStanza(ctx context.Context, stanza stravaganza.Stanza) error

	// Start starts component.
	Start(ctx context.Context) error

	// Stop stops component.
	Stop(ctx context.Context) error
}

Component represents generic component interface.

type Components added in v0.3.4

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

Components is the global component hub.

func NewComponents added in v0.50.0

func NewComponents(components []Component) *Components

NewComponents returns a new initialized Components instance.

func (*Components) AllComponents added in v0.50.0

func (c *Components) AllComponents() []Component

AllComponents returns all registered components.

func (*Components) Component added in v0.50.0

func (c *Components) Component(cHost string) Component

Component returns the component associated to cHost.

func (*Components) IsComponentHost added in v0.50.0

func (c *Components) IsComponentHost(cHost string) bool

IsComponentHost tells whether cHost corresponds to some registered component.

func (*Components) ProcessStanza added in v0.50.0

func (c *Components) ProcessStanza(ctx context.Context, stanza stravaganza.Stanza) error

ProcessStanza will route stanza to proper component based on receiver JID address.

func (*Components) RegisterComponent added in v0.50.0

func (c *Components) RegisterComponent(ctx context.Context, comp Component) error

RegisterComponent registers a new component.

func (*Components) Start added in v0.50.0

func (c *Components) Start(ctx context.Context) error

Start starts components.

func (*Components) Stop added in v0.50.0

func (c *Components) Stop(ctx context.Context) error

Stop stops components.

func (*Components) UnregisterComponent added in v0.50.0

func (c *Components) UnregisterComponent(ctx context.Context, cHost string) error

UnregisterComponent unregisters a previously registered component.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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