service

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 25 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTP

func NewHTTP(requestHandler *RequestHandler) *router.Router

NewHTTP return router handle HTTP request

Types

type Config

type Config struct {
	grpc.Config
	ResourceDirectoryAddr string `envconfig:"RESOURCE_DIRECTORY_ADDRESS"  default:"127.0.0.1:9100"`
	ResourceAggregateAddr string `envconfig:"RESOURCE_AGGREGATE_ADDRESS"  default:"127.0.0.1:9100"`
}

Config represent application configuration

func (Config) String

func (c Config) String() string

String return string representation of Config

type Device

type Device struct {
	Id       string        `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Resource schema.Device `protobuf:"bytes,2,opt,name=resource" json:"resource,omitempty"`
	State    *State        `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"`
}

type DeviceResources

type DeviceResources struct {
	Resources map[string]schema.ResourceLink `json:"resources"`
}

type DialCertManager

type DialCertManager = interface {
	GetClientTLSConfig() *tls.Config
}

type GetDevicesResponse

type GetDevicesResponse struct {
	Devices map[string]*Device `json:"devices"`
}

type GetResourceLinksResponse

type GetResourceLinksResponse struct {
	Devices map[string]*DeviceResources `json:"devices"`
}

type ListenCertManager

type ListenCertManager = interface {
	GetServerTLSConfig() *tls.Config
}

type RequestHandler

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

RequestHandler for handling incoming request

func NewRequestHandler

func NewRequestHandler(server *Server, raClient pbRA.ResourceAggregateClient, rdClient pbGRPC.GrpcGatewayClient) *RequestHandler

NewRequestHandler factory for new RequestHandler

type Server

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

Server handle HTTP request

func New

func New(config Config, dialCertManager DialCertManager, listenCertManager ListenCertManager) *Server

New create new Server with provided stores

func (*Server) Serve

func (s *Server) Serve() error

Serve starts server and handle OS signals.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown ends serving

type State

type State struct {
	Id          string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	IsOnline    bool   `protobuf:"varint,2,opt,name=is_online,json=isOnline,proto3" json:"is_online,omitempty"`
	IsConnected bool   `protobuf:"varint,3,opt,name=is_connected,json=isConnected,proto3" json:"is_connected,omitempty"`
}

Jump to

Keyboard shortcuts

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