exchangers

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsEntityCollection

func AsEntityCollection(collection Collection) entity.Collection

AsEntityCollection transforms an exchanger collection into an entity collection.

func StartExchangers

func StartExchangers(collection Collection) error

StartExchangers starts the given exchangers.

func StopExchangers

func StopExchangers(collection Collection)

StopExchangers stops the given exchangers.

Types

type BaseExchanger

type BaseExchanger struct {
	Exchanger
	// contains filtered or unexported fields
}

BaseExchanger implements basic exchanger functionality common to all exchangers.

func (*BaseExchanger) Activate

func (exchanger *BaseExchanger) Activate(conf *config.Configuration, log *zerolog.Logger) error

Activate activates the exchanger.

func (*BaseExchanger) Config

func (exchanger *BaseExchanger) Config() *config.Configuration

Config returns the configuration object.

func (*BaseExchanger) EnabledConnectors

func (exchanger *BaseExchanger) EnabledConnectors() []string

EnabledConnectors returns the list of all enabled connectors for the exchanger.

func (*BaseExchanger) IsConnectorEnabled

func (exchanger *BaseExchanger) IsConnectorEnabled(id string) bool

IsConnectorEnabled checks if the given connector is enabled for the exchanger.

func (*BaseExchanger) Locker

func (exchanger *BaseExchanger) Locker() *sync.RWMutex

Locker returns the locking object.

func (*BaseExchanger) Log

func (exchanger *BaseExchanger) Log() *zerolog.Logger

Log returns the logger object.

func (*BaseExchanger) SetEnabledConnectors

func (exchanger *BaseExchanger) SetEnabledConnectors(connectors []string)

SetEnabledConnectors sets the list of all enabled connectors for the exchanger.

func (*BaseExchanger) Start

func (exchanger *BaseExchanger) Start() error

Start starts the exchanger; only exchanger which perform periodical background tasks should do something here.

func (*BaseExchanger) Stop

func (exchanger *BaseExchanger) Stop()

Stop stops any running background activities of the exchanger.

type BaseRequestExchanger

type BaseRequestExchanger struct {
	RequestExchanger
	// contains filtered or unexported fields
}

BaseRequestExchanger implements basic exporter functionality common to all request exporters.

func (*BaseRequestExchanger) Endpoint

func (exchanger *BaseRequestExchanger) Endpoint() string

Endpoint returns the (relative) endpoint of the exchanger.

func (*BaseRequestExchanger) HandleRequest

func (exchanger *BaseRequestExchanger) HandleRequest(resp http.ResponseWriter, req *http.Request) error

HandleRequest handles the actual HTTP request.

func (*BaseRequestExchanger) SetEndpoint

func (exchanger *BaseRequestExchanger) SetEndpoint(endpoint string)

SetEndpoint sets the (relative) endpoint of the exchanger.

func (*BaseRequestExchanger) WantsRequest

func (exchanger *BaseRequestExchanger) WantsRequest(r *http.Request) bool

WantsRequest returns whether the exporter wants to handle the incoming request.

type Collection

type Collection interface {
	entity.Collection

	// Exchangers returns a vector of exchangers within the collection.
	Exchangers() []Exchanger
}

Collection is an interface for exchanger collections.

type Exchanger

type Exchanger interface {
	entity.Entity

	// Start starts the exchanger; only exchangers which perform periodical background tasks should do something here.
	Start() error
	// Stop stops any running background activities of the exchanger.
	Stop()
}

Exchanger is the base interface for importers and exporters.

type RequestExchanger

type RequestExchanger interface {
	// Endpoint returns the (relative) endpoint of the exchanger.
	Endpoint() string
	// WantsRequest returns whether the exchanger wants to handle the incoming request.
	WantsRequest(r *http.Request) bool
	// HandleRequest handles the actual HTTP request.
	HandleRequest(resp http.ResponseWriter, req *http.Request)
}

RequestExchanger is the interface implemented by exchangers that offer an HTTP endpoint.

func GetRequestExchangers

func GetRequestExchangers(collection Collection) []RequestExchanger

GetRequestExchangers gets all exchangers from a vector that implement the RequestExchanger interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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