monitor

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package monitor is a generated protocol buffer package.

It is generated from these files:

github.com/TheThingsNetwork/ttn/api/monitor/monitor.proto

It has these top-level messages:

Index

Constants

View Source
const BufferSize = 10

BufferSize gives the size for the monitor buffers

Variables

This section is empty.

Functions

func RegisterMonitorServer

func RegisterMonitorServer(s *grpc.Server, srv MonitorServer)

Types

type BrokerClient

type BrokerClient interface {
	SendUplink(msg *broker.DeduplicatedUplinkMessage) (err error)
	SendDownlink(msg *broker.DownlinkMessage) (err error)
	Close() (err error)
}

BrokerClient is used as the main client for Brokers to communicate with the monitor

type Client

type Client struct {
	Ctx ttnlog.Interface

	BrokerClient BrokerClient
	// contains filtered or unexported fields
}

Client is a wrapper around MonitorClient

func NewClient

func NewClient(ctx ttnlog.Interface, monitorAddr string) (cl *Client, err error)

NewClient is a wrapper for NewMonitorClient, initializes connection to MonitorServer on monitorAddr with default gRPC options

func (*Client) Close

func (cl *Client) Close() (err error)

Close closes connection to the monitor

func (*Client) GatewayClient

func (cl *Client) GatewayClient(id string) (gtwCl GatewayClient)

GatewayClient returns monitor GatewayClient for id and token specified

func (*Client) IsConnected

func (cl *Client) IsConnected() bool

IsConnected returns whether connection to the monitor had been established or not

func (*Client) Open

func (cl *Client) Open() (err error)

Open opens connection to the monitor

func (*Client) Reopen

func (cl *Client) Reopen() (err error)

Reopen reopens connection to the monitor. It first attempts to close already opened connection and then opens a new one. If closing already opened connection fails, Reopen fails too.

type GatewayClient

type GatewayClient interface {
	SetToken(token string)
	IsConfigured() bool
	SendStatus(status *gateway.Status) (err error)
	SendUplink(msg *router.UplinkMessage) (err error)
	SendDownlink(msg *router.DownlinkMessage) (err error)
	Close() (err error)
}

GatewayClient is used as the main client for Gateways to communicate with the monitor

type MonitorClient

type MonitorClient interface {
	GatewayStatus(ctx context.Context, opts ...grpc.CallOption) (Monitor_GatewayStatusClient, error)
	GatewayUplink(ctx context.Context, opts ...grpc.CallOption) (Monitor_GatewayUplinkClient, error)
	GatewayDownlink(ctx context.Context, opts ...grpc.CallOption) (Monitor_GatewayDownlinkClient, error)
	BrokerUplink(ctx context.Context, opts ...grpc.CallOption) (Monitor_BrokerUplinkClient, error)
	BrokerDownlink(ctx context.Context, opts ...grpc.CallOption) (Monitor_BrokerDownlinkClient, error)
}

func NewMonitorClient

func NewMonitorClient(cc *grpc.ClientConn) MonitorClient

type MonitorServer

type MonitorServer interface {
	GatewayStatus(Monitor_GatewayStatusServer) error
	GatewayUplink(Monitor_GatewayUplinkServer) error
	GatewayDownlink(Monitor_GatewayDownlinkServer) error
	BrokerUplink(Monitor_BrokerUplinkServer) error
	BrokerDownlink(Monitor_BrokerDownlinkServer) error
}

type Monitor_BrokerDownlinkClient

type Monitor_BrokerDownlinkClient interface {
	Send(*broker.DownlinkMessage) error
	CloseAndRecv() (*google_protobuf1.Empty, error)
	grpc.ClientStream
}

type Monitor_BrokerDownlinkServer

type Monitor_BrokerDownlinkServer interface {
	SendAndClose(*google_protobuf1.Empty) error
	Recv() (*broker.DownlinkMessage, error)
	grpc.ServerStream
}

type Monitor_BrokerUplinkClient

type Monitor_BrokerUplinkClient interface {
	Send(*broker.DeduplicatedUplinkMessage) error
	CloseAndRecv() (*google_protobuf1.Empty, error)
	grpc.ClientStream
}

type Monitor_BrokerUplinkServer

type Monitor_BrokerUplinkServer interface {
	SendAndClose(*google_protobuf1.Empty) error
	Recv() (*broker.DeduplicatedUplinkMessage, error)
	grpc.ServerStream
}

type Monitor_GatewayDownlinkClient

type Monitor_GatewayDownlinkClient interface {
	Send(*router.DownlinkMessage) error
	CloseAndRecv() (*google_protobuf1.Empty, error)
	grpc.ClientStream
}

type Monitor_GatewayDownlinkServer

type Monitor_GatewayDownlinkServer interface {
	SendAndClose(*google_protobuf1.Empty) error
	Recv() (*router.DownlinkMessage, error)
	grpc.ServerStream
}

type Monitor_GatewayStatusClient

type Monitor_GatewayStatusClient interface {
	Send(*gateway.Status) error
	CloseAndRecv() (*google_protobuf1.Empty, error)
	grpc.ClientStream
}

type Monitor_GatewayStatusServer

type Monitor_GatewayStatusServer interface {
	SendAndClose(*google_protobuf1.Empty) error
	Recv() (*gateway.Status, error)
	grpc.ServerStream
}

type Monitor_GatewayUplinkClient

type Monitor_GatewayUplinkClient interface {
	Send(*router.UplinkMessage) error
	CloseAndRecv() (*google_protobuf1.Empty, error)
	grpc.ClientStream
}

type Monitor_GatewayUplinkServer

type Monitor_GatewayUplinkServer interface {
	SendAndClose(*google_protobuf1.Empty) error
	Recv() (*router.UplinkMessage, error)
	grpc.ServerStream
}

type Registry

type Registry interface {
	// InitClient initializes a new monitor client.
	InitClient(name string, addr string)

	// BrokerClients returns the list of broker monitor clients that have currently been initialized.
	BrokerClients() []BrokerClient

	// GatewayClients returns the list of gateway monitor clients that have currently been initialized for a given gateway.
	GatewayClients(id string) []GatewayClient

	// SetGatewayToken configures a token that's applied to all clients for a gateway, regardless of when it's initialized.
	SetGatewayToken(id string, token string)
}

Registry encapsulates dealing with monitor servers that might be down during startup.

func NewRegistry

func NewRegistry(ctx ttnlog.Interface) Registry

NewRegistry creates a monitor client registry.

Jump to

Keyboard shortcuts

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