component

package
v3.0.0-pre.0...-f1e8a59 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package component contains the methods and structures common to all components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	FrequencyPlans *frequencyplans.Store
	// contains filtered or unexported fields
}

Component is a base component for The Things Network cluster

func MustNew

func MustNew(logger log.Stack, config *Config) *Component

MustNew calls New and returns a new component or panics on an error. In most cases, you should just use New.

func New

func New(logger log.Stack, config *Config) (*Component, error)

New returns a new component

func (*Component) AddContextFiller

func (c *Component) AddContextFiller(f fillcontext.Filler)

AddContextFiller adds the specified filler

func (*Component) AllowInsecureForCredentials

func (c *Component) AllowInsecureForCredentials() bool

AllowInsecureForCredentials returns `true` if the component was configured to allow transmission of credentials over insecure transports.

func (*Component) ClaimIDs

func (c *Component) ClaimIDs(ctx context.Context, ids ttnpb.Identifiers) error

ClaimIDs claims the identifiers in the cluster. See package ../cluster for more information.

func (*Component) Close

func (c *Component) Close()

Close closes the server

func (*Component) ClusterAuthStreamHook

func (c *Component) ClusterAuthStreamHook() hooks.StreamHandlerMiddleware

ClusterAuthStreamHook ensuring the caller of an RPC is part of the cluster. If a call can't be identified as coming from the cluster, it will be discarded.

func (*Component) ClusterAuthUnaryHook

func (c *Component) ClusterAuthUnaryHook() hooks.UnaryHandlerMiddleware

ClusterAuthUnaryHook ensuring the caller of an RPC is part of the cluster. If a call can't be identified as coming from the cluster, it will be discarded.

func (*Component) Context

func (c *Component) Context() context.Context

Context returns the context of the component

func (*Component) FillContext

func (c *Component) FillContext(ctx context.Context) context.Context

FillContext fills the context

func (*Component) GetPeer

GetPeer returns a cluster peer with the given role and the given tags. See package ../cluster for more information.

func (*Component) GetPeers

func (c *Component) GetPeers(ctx context.Context, role ttnpb.PeerInfo_Role) []cluster.Peer

GetPeers returns cluster peers with the given role and the given tags. See package ../cluster for more information.

func (*Component) ListenTCP

func (c *Component) ListenTCP(address string) (Listener, error)

ListenTCP listens on a TCP address and allows for TCP and TLS on the same port.

func (*Component) ListenUDP

func (c *Component) ListenUDP(address string) (*net.UDPConn, error)

ListenUDP starts a listener on a UDP address.

func (*Component) Logger

func (c *Component) Logger() log.Stack

Logger returns the logger of the component

func (*Component) RegisterGRPC

func (c *Component) RegisterGRPC(s rpcserver.Registerer)

RegisterGRPC registers a gRPC subsystem to the component

func (*Component) RegisterWeb

func (c *Component) RegisterWeb(s web.Registerer)

RegisterWeb registers a web subsystem to the component

func (*Component) Run

func (c *Component) Run() error

Run starts the component, and returns when a stop signal has been received by the process.

func (*Component) ServeHTTP

func (c *Component) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Component) Start

func (c *Component) Start() (err error)

Start starts the component

func (*Component) UnclaimIDs

func (c *Component) UnclaimIDs(ctx context.Context, ids ttnpb.Identifiers) error

UnclaimIDs unclaims the identifiers in the cluster. See package ../cluster for more information.

func (*Component) WithClusterAuth

func (c *Component) WithClusterAuth() grpc.CallOption

WithClusterAuth that can be used to identify a component within a cluster.

type Config

type Config struct {
	config.ServiceBase `name:",squash" yaml:",inline"`
}

Config is the type of configuration for Components

type Listener

type Listener interface {
	TLS() (net.Listener, error)
	TCP() (net.Listener, error)
	Close() error
}

Listener that accepts multiple protocols on the same port

Jump to

Keyboard shortcuts

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