Documentation ¶
Index ¶
- Variables
- type Client
- type ClientConfig
- type GenericStream
- type RouterStreamServer
- func (s *RouterStreamServer) GatewayStatus(stream Router_GatewayStatusServer) error
- func (s *RouterStreamServer) SetLogger(logger log.Interface)
- func (s *RouterStreamServer) Subscribe(req *SubscribeRequest, stream Router_SubscribeServer) (err error)
- func (s *RouterStreamServer) Uplink(stream Router_UplinkServer) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClientConfig = ClientConfig{ BackgroundContext: context.Background(), BufferSize: 10, }
DefaultClientConfig for router Client
View Source
var ErrDownlinkInactive = errors.New("Downlink stream not active")
ErrDownlinkInactive is returned by the Downlink func if downlink is inactive
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for router
func NewClient ¶
func NewClient(config ClientConfig) *Client
NewClient creates a new Client with the given configuration
func (*Client) AddServer ¶
func (c *Client) AddServer(name string, conn *grpc.ClientConn)
AddServer adds a router server
func (*Client) NewGatewayStreams ¶
func (c *Client) NewGatewayStreams(id string, token string, downlinkActive bool) GenericStream
NewGatewayStreams returns new streams using the given gateway ID and token
type ClientConfig ¶
ClientConfig for router Client
type GenericStream ¶
type GenericStream interface { Uplink(*UplinkMessage) Status(*gateway.Status) Downlink() (<-chan *DownlinkMessage, error) Close() }
GenericStream is used for sending to and receiving from the router.
type RouterStreamServer ¶
type RouterStreamServer struct { UplinkChanFunc func(md metadata.MD) (ch chan *UplinkMessage, err error) GatewayStatusChanFunc func(md metadata.MD) (ch chan *gateway.Status, err error) DownlinkChanFunc func(md metadata.MD) (ch <-chan *DownlinkMessage, cancel func(), err error) // contains filtered or unexported fields }
RouterStreamServer handles gRPC streams as channels
func NewRouterStreamServer ¶
func NewRouterStreamServer() *RouterStreamServer
NewRouterStreamServer returns a new RouterStreamServer
func (*RouterStreamServer) GatewayStatus ¶
func (s *RouterStreamServer) GatewayStatus(stream Router_GatewayStatusServer) error
GatewayStatus handles gateway status streams
func (*RouterStreamServer) SetLogger ¶
func (s *RouterStreamServer) SetLogger(logger log.Interface)
SetLogger sets the logger
func (*RouterStreamServer) Subscribe ¶
func (s *RouterStreamServer) Subscribe(req *SubscribeRequest, stream Router_SubscribeServer) (err error)
Subscribe handles downlink streams
func (*RouterStreamServer) Uplink ¶
func (s *RouterStreamServer) Uplink(stream Router_UplinkServer) (err error)
Uplink handles uplink streams
Click to show internal directories.
Click to hide internal directories.