Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterService ¶
func RegisterService(r Registration) error
RegisterService is a function that registers a service with the service registry.
Types ¶
type DBRegister ¶ added in v0.3.0
type DBRegister struct { // Required is a flag that indicates whether the service requires a database connection. Required bool // Migrations is an embedded filesystem that contains the Goose SQL migrations for the service. // This is required to support the `migrate` command or the `runMigrations` configuration option. // More information on Goose can be found at https://github.com/pressly/goose Migrations *embed.FS }
DBRegister is a struct that holds the information needed to register a service with a database
type HandlerServer ¶
type NamespaceMap ¶ added in v0.3.0
type NamespaceMap map[string]ServiceMap
var RegisteredServices NamespaceMap
RegisteredServices is a map of namespaces to services TODO remove the global variable and move towards a more functional approach
type RegisterFunc ¶
type RegisterFunc func(RegistrationParams) (Impl any, HandlerServer HandlerServer)
type Registration ¶
type Registration struct { // Namespace is the namespace of the service. One or more gRPC services can be registered under // the same namespace. Namespace string // ServiceDesc is the gRPC service descriptor. For non-gRPC services, this can be mocked out, // but at minimum, the ServiceName field must be set ServiceDesc *grpc.ServiceDesc // RegisterFunc is the function that will be called to register the service RegisterFunc RegisterFunc // DB is optional and used to register the service with a database DB DBRegister }
Registration is a struct that holds the information needed to register a service
type RegistrationParams ¶
type RegistrationParams struct { // Config scoped to the service config. Since the main config contains all the service configs, // which could have need-to-know information we don't want to expose it to all services. Config ServiceConfig // OTDF is the OpenTDF server that can be used to interact with the OpenTDFServer instance. OTDF *server.OpenTDFServer // DBClient is the database client that can be used to interact with the database. This client // is scoped to the service namespace and will not be shared with other service namespaces. DBClient *db.Client // SDK is the OpenTDF SDK that can be used to interact with the OpenTDF SDK. This is useful for // gRPC Inter Process Communication (IPC) between services. This ensures the services are // communicating with each other by contract as well as supporting the various deployment models // that OpenTDF supports. SDK *sdk.SDK // Logger is the logger that can be used to log messages. This logger is scoped to the service Logger *logger.Logger // RegisterWellKnownConfig is a function that can be used to register a well-known configuration WellKnownConfig func(namespace string, config any) error // RegisterReadinessCheck is a function that can be used to register a readiness check for the // service. This is useful for services that need to perform some initialization before they are // ready to serve requests. This function should be called in the RegisterFunc function. RegisterReadinessCheck func(namespace string, check func(context.Context) error) error }
RegistrationParams is a struct that holds the parameters needed to register a service with the service registry. These parameters are passed to the RegisterFunc function defined in the Registration struct.
type RemoteServiceConfig ¶
type RemoteServiceConfig struct {
Endpoint string `yaml:"endpoint"`
}
type Service ¶
type Service struct { Registration // Started is a flag that indicates whether the service has been started Started bool // Close is a function that can be called to close the service Close func() }
Service is a struct that holds the registration information for a service as well as the state of the service within the instance of the platform.
type ServiceConfig ¶
type ServiceConfig struct { Enabled bool `yaml:"enabled"` Remote RemoteServiceConfig `yaml:"remote"` ExtraProps map[string]interface{} `json:"-" mapstructure:",remain"` }
ServiceConfig is a struct that holds the configuration for a service and used for the global config rollup powered by Viper (https://github.com/spf13/viper)