service

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

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