serviceregistry

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause-Clear Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterService

func RegisterService(r Registration) error

Types

type DBRegister added in v0.3.0

type DBRegister struct {
	Required bool
	// Required to support automatic migrations
	Migrations *embed.FS
}

type HandlerServer

type HandlerServer func(ctx context.Context, mux *runtime.ServeMux, server any) error

type NamespaceMap added in v0.3.0

type NamespaceMap map[string]ServiceMap
var RegisteredServices NamespaceMap

Map of namespaces to services

type RegisterFunc

type RegisterFunc func(RegistrationParams) (Impl any, HandlerServer HandlerServer)

type Registration

type Registration struct {
	Namespace    string
	ServiceDesc  *grpc.ServiceDesc
	RegisterFunc RegisterFunc

	// Optional to specify if the service requires a database connection
	DB DBRegister
}

type RegistrationParams

type RegistrationParams struct {
	Config          ServiceConfig
	OTDF            *server.OpenTDFServer
	DBClient        *db.Client
	Engine          *opa.Engine
	SDK             *sdk.SDK
	WellKnownConfig func(namespace string, config any) error
}

type RemoteServiceConfig

type RemoteServiceConfig struct {
	Endpoint string `yaml:"endpoint"`
}

type Service

type Service struct {
	Registration
	Started bool
	Close   func()
}

type ServiceConfig

type ServiceConfig struct {
	Enabled    bool                   `yaml:"enabled"`
	Remote     RemoteServiceConfig    `yaml:"remote"`
	ExtraProps map[string]interface{} `json:"-" mapstructure:",remain"`
}

type ServiceMap added in v0.3.0

type ServiceMap map[string]Service

Jump to

Keyboard shortcuts

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