service

package
v2.4.7 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0, MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandler

func AddHandler(ctx context.Context, svr *server.Server, config Config, publicConfiguration PublicConfiguration, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider, goroutinePoolGo func(func()) error) error

func NewAuth

func NewDeviceMetadataProjection

func NewDeviceMetadataProjection(deviceID string) eventstore.Model

func NewEventStoreModelFactory

func NewEventStoreModelFactory() func(context.Context, string, string) (eventstore.Model, error)

func NewResourceLinksProjection

func NewResourceLinksProjection(deviceID string) eventstore.Model

func NewResourceProjection

func NewResourceProjection() eventstore.Model

func Register

func Register(server *grpc.Server, handler *RequestHandler)

Register registers the handler instance with a gRPC server.

Types

type APIsConfig

type APIsConfig struct {
	GRPC GRPCConfig `yaml:"grpc" json:"grpc"`
}

Config represent application configuration

func (*APIsConfig) Validate

func (c *APIsConfig) Validate() error

type ClientsConfig

type ClientsConfig struct {
	Eventbus               EventBusConfig      `yaml:"eventBus" json:"eventBus"`
	Eventstore             EventStoreConfig    `yaml:"eventStore" json:"eventStore"`
	IdentityStore          IdentityStoreConfig `yaml:"identityStore" json:"identityStore"`
	OpenTelemetryCollector otelClient.Config   `yaml:"openTelemetryCollector" json:"openTelemetryCollector"`
}

func (*ClientsConfig) Validate

func (c *ClientsConfig) Validate() error

type Config

type Config struct {
	Log                     log.Config          `yaml:"log" json:"log"`
	APIs                    APIsConfig          `yaml:"apis" json:"apis"`
	Clients                 ClientsConfig       `yaml:"clients" json:"clients"`
	ExposedHubConfiguration PublicConfiguration `yaml:"publicConfiguration" json:"publicConfiguration"`
}

func (Config) String

func (c Config) String() string

String return string representation of Config

func (*Config) Validate

func (c *Config) Validate() error

type Device

type Device struct {
	ID              string
	Content         *device.Device
	ResourceChanged *events.ResourceChanged
	Metadata        *pb.Device_Metadata
	Endpoints       []*commands.EndpointInformation
}

func (Device) ToProto

func (d Device) ToProto() *pb.Device

type DeviceDirectory

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

func NewDeviceDirectory

func NewDeviceDirectory(projection *Projection, deviceIds []string) *DeviceDirectory

NewDeviceDirectory creates new device directory.

func (*DeviceDirectory) GetDevices

func (dd *DeviceDirectory) GetDevices(req *pb.GetDevicesRequest, srv pb.GrpcGateway_GetDevicesServer) (err error)

type EventBusConfig

type EventBusConfig struct {
	GoPoolSize int               `yaml:"goPoolSize" json:"goPoolSize"`
	NATS       natsClient.Config `yaml:"nats" json:"nats"`
}

func (*EventBusConfig) Validate

func (c *EventBusConfig) Validate() error

type EventStoreConfig

type EventStoreConfig struct {
	ProjectionCacheExpiration time.Duration           `yaml:"cacheExpiration" json:"cacheExpiration"`
	Connection                eventstoreConfig.Config `yaml:",inline" json:",inline"`
}

func (*EventStoreConfig) Validate

func (c *EventStoreConfig) Validate() error

type GRPCConfig

type GRPCConfig struct {
	OwnerCacheExpiration time.Duration `yaml:"ownerCacheExpiration" json:"ownerCacheExpiration"`
	server.Config        `yaml:",inline" json:",inline"`
}

func (*GRPCConfig) Validate

func (c *GRPCConfig) Validate() error

type IdentityStoreConfig

type IdentityStoreConfig struct {
	Connection client.Config `yaml:"grpc" json:"grpc"`
}

func (*IdentityStoreConfig) Validate

func (c *IdentityStoreConfig) Validate() error

type Projection

type Projection struct {
	*projectionRA.Projection
	// contains filtered or unexported fields
}

func NewProjection

func NewProjection(ctx context.Context, name string, store eventstore.EventStore, subscriber eventbus.Subscriber, newModelFunc eventstore.FactoryModelFunc, expiration time.Duration) (*Projection, error)

func (*Projection) LoadDevicesMetadata added in v2.4.0

func (p *Projection) LoadDevicesMetadata(ctx context.Context, deviceIDFilter, toReloadDevices strings.Set, onDeviceMetadataProjection func(m *deviceMetadataProjection) error) error
func (p *Projection) LoadResourceLinks(ctx context.Context, deviceIDFilter, toReloadDevices strings.Set, onResourceLinkProjection func(m *resourceLinksProjection) error) error
func (p *Projection) LoadResourcesWithLinks(ctx context.Context, resourceIDFilter []*commands.ResourceId, typeFilter strings.Set, toReloadDevices strings.Set, onResource func(*Resource) error) error

func (*Projection) ReloadDevices added in v2.4.0

func (p *Projection) ReloadDevices(ctx context.Context, deviceIDFilter strings.Set)

type PublicConfiguration

type PublicConfiguration struct {
	CAPool                   string        `yaml:"caPool" json:"caPool" description:"file path to the root certificate in PEM format"`
	OwnerClaim               string        `yaml:"ownerClaim" json:"ownerClaim"`
	DeviceIDClaim            string        `yaml:"deviceIDClaim" json:"deviceIdClaim"`
	HubID                    string        `yaml:"hubID" json:"hubId"`
	CoapGateway              string        `yaml:"coapGateway" json:"coapGateway"`
	DefaultCommandTimeToLive time.Duration `yaml:"defaultCommandTimeToLive" json:"defaultCommandTimeToLive"`
	AuthorizationServer      string        `yaml:"authorizationServer" json:"authorizationServer"`
	// contains filtered or unexported fields
}

func (PublicConfiguration) ToProto

func (*PublicConfiguration) Validate

func (c *PublicConfiguration) Validate() error

type RequestHandler

type RequestHandler struct {
	pb.UnimplementedGrpcGatewayServer
	// contains filtered or unexported fields
}

RequestHandler handles incoming requests.

func NewRequestHandler

func NewRequestHandler(
	resourceProjection *Projection,
	eventstore eventstore.EventStore,
	publicConfiguration PublicConfiguration,
	ownerCache *clientIS.OwnerCache,
	closeFunc fn.FuncList,
) *RequestHandler

NewRequestHandler factory for new RequestHandler.

func (*RequestHandler) Close

func (r *RequestHandler) Close()

func (*RequestHandler) GetDevices

func (*RequestHandler) GetDevicesMetadata

func (*RequestHandler) GetEvents

func (*RequestHandler) GetHubConfiguration

func (*RequestHandler) GetPendingCommands

func (*RequestHandler) GetResources

type Resource

type Resource struct {
	Resource *commands.Resource
	// contains filtered or unexported fields
}

func (*Resource) GetContent

func (r *Resource) GetContent() *commands.Content

func (*Resource) GetResourceChanged

func (r *Resource) GetResourceChanged() *events.ResourceChanged

type ResourceDirectory

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

func NewResourceDirectory

func NewResourceDirectory(projection *Projection, deviceIds []string) *ResourceDirectory

type ResourceShadow

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

func NewResourceShadow

func NewResourceShadow(projection *Projection, deviceIds []string) *ResourceShadow

func (*ResourceShadow) GetDevicesMetadata

func (*ResourceShadow) GetPendingCommands

func (*ResourceShadow) GetResources

type Service

type Service struct {
	*server.Server
}

func New

func New(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logger log.Logger) (*Service, error)

Jump to

Keyboard shortcuts

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