Documentation ¶
Overview ¶
Package services implements the components required to serve the services
Index ¶
- Variables
- type EndpointContext
- type EndpointInitializer
- type HostContext
- func (h *HostContext) GetAppData() string
- func (h *HostContext) GetContext() context.Context
- func (h *HostContext) GetHost() HostKind
- func (h *HostContext) GetLogMessage(message string) string
- func (h *HostContext) GetLogger() *zap.Logger
- func (h *HostContext) GetParentLoggerMessage() string
- func (h *HostContext) Shutdown(ctx context.Context)
- type HostInfo
- type HostKind
- type Hostable
- type ServiceContext
- func (s *ServiceContext) GetAppData() string
- func (s *ServiceContext) GetContext() context.Context
- func (s *ServiceContext) GetLogMessage(message string) string
- func (s *ServiceContext) GetLogger() *zap.Logger
- func (s *ServiceContext) GetParentLoggerMessage() string
- func (s *ServiceContext) GetService() ServiceKind
- type ServiceFactory
- type ServiceFactoryConfig
- type ServiceFactoryProvider
- type ServiceInitializer
- type ServiceKind
- type Serviceable
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type EndpointContext ¶
type EndpointContext struct {
// contains filtered or unexported fields
}
EndpointContext is the endpoint context.
func NewEndpointContext ¶
func NewEndpointContext(serviceContext *ServiceContext, port int) (*EndpointContext, error)
NewEndpointContext creates a new endpoint context.
func (*EndpointContext) GetContext ¶
func (e *EndpointContext) GetContext() context.Context
GetContext returns the context.
func (*EndpointContext) GetLogMessage ¶
func (e *EndpointContext) GetLogMessage(message string) string
GetLogMessage returns a well formatted log message.
func (*EndpointContext) GetLogger ¶
func (e *EndpointContext) GetLogger() *zap.Logger
GetLogger returns the logger.
func (*EndpointContext) GetParentLoggerMessage ¶
func (e *EndpointContext) GetParentLoggerMessage() string
GetParentLoggerMessage returns the parent logger message.
type EndpointInitializer ¶
type EndpointInitializer struct {
// contains filtered or unexported fields
}
EndpointInitializer is the service endpoint factory.
func NewEndpointInitializer ¶
func NewEndpointInitializer(service ServiceKind, port int, registration func(*grpc.Server, *ServiceContext, *EndpointContext, *azstorage.StorageConnector) error) (EndpointInitializer, error)
NewEndpointInitializer creates a new service endpoint factory.
func (EndpointInitializer) GetPort ¶
func (d EndpointInitializer) GetPort() int
GetPort returns the port.
func (EndpointInitializer) GetRegistration ¶
func (d EndpointInitializer) GetRegistration() func(*grpc.Server, *ServiceContext, *EndpointContext, *azstorage.StorageConnector) error
GetRegistration returns the registration.
func (EndpointInitializer) GetService ¶
func (d EndpointInitializer) GetService() ServiceKind
GetService returns the service kind.
type HostContext ¶
type HostContext struct {
// contains filtered or unexported fields
}
HostContext is the host context.
func NewHostContext ¶
func NewHostContext(host HostKind, hostable Hostable, logger *zap.Logger, appData string) (*HostContext, error)
NewHostContext creates a new host context.
func (*HostContext) GetAppData ¶
func (h *HostContext) GetAppData() string
GetAppData returns the app data.
func (*HostContext) GetContext ¶
func (h *HostContext) GetContext() context.Context
GetContext returns the context.
func (*HostContext) GetLogMessage ¶
func (h *HostContext) GetLogMessage(message string) string
GetLogMessage returns a well formatted log message.
func (*HostContext) GetLogger ¶
func (h *HostContext) GetLogger() *zap.Logger
GetLogger returns the logger.
func (*HostContext) GetParentLoggerMessage ¶
func (h *HostContext) GetParentLoggerMessage() string
GetParentLoggerMessage returns the parent logger message.
func (*HostContext) Shutdown ¶
func (h *HostContext) Shutdown(ctx context.Context)
Shutdown shuts down the service.
type HostKind ¶
type HostKind string
HostKind represents the type of service host.
func NewHostKindFromString ¶
NewHostKindFromString creates a new host kind from a string.
func (HostKind) CanHost ¶
func (s HostKind) CanHost(service ServiceKind, hosts []HostKind) bool
CanHost returns true if the service can host the desired service.
func (HostKind) GetServices ¶
func (s HostKind) GetServices(hosts []HostKind, services []ServiceKind) []ServiceKind
GetServices returns the hostable services.
type Hostable ¶
type Hostable interface { Serve(ctx context.Context, onShutdown func()) (bool, error) Shutdown(context.Context) }
Hostable must be implemented by hostable components.
type ServiceContext ¶
type ServiceContext struct {
// contains filtered or unexported fields
}
ServiceContext is the service context.
func NewServiceContext ¶
func NewServiceContext(hostContext *HostContext, service ServiceKind) (*ServiceContext, error)
NewServiceContext creates a new service context.
func (*ServiceContext) GetAppData ¶
func (s *ServiceContext) GetAppData() string
GetAppData returns the app data.
func (*ServiceContext) GetContext ¶
func (s *ServiceContext) GetContext() context.Context
GetContext returns the context.
func (*ServiceContext) GetLogMessage ¶
func (s *ServiceContext) GetLogMessage(message string) string
GetLogMessage returns a well formatted log message.
func (*ServiceContext) GetLogger ¶
func (s *ServiceContext) GetLogger() *zap.Logger
GetLogger returns the logger.
func (*ServiceContext) GetParentLoggerMessage ¶
func (s *ServiceContext) GetParentLoggerMessage() string
GetParentLoggerMessage returns the parent logger message.
func (*ServiceContext) GetService ¶
func (s *ServiceContext) GetService() ServiceKind
GetService returns the service.
type ServiceFactory ¶
type ServiceFactory interface {
Create() (Serviceable, error)
}
ServiceFactory is the service factory.
type ServiceFactoryConfig ¶
type ServiceFactoryConfig interface { azconfigs.Configurable }
ServiceFactoryConfig is the service factory config.
type ServiceFactoryProvider ¶
type ServiceFactoryProvider struct {
// contains filtered or unexported fields
}
ServiceFactoryProvider is the service provider.
func NewServiceFactoryProvider ¶
func NewServiceFactoryProvider(funcSvcFactCfg func() (ServiceFactoryConfig, error), funcSvcFact func(ServiceFactoryConfig) (ServiceFactory, error)) (*ServiceFactoryProvider, error)
NewServiceFactoryProvider creates a new service factory provider.
func (ServiceFactoryProvider) CreateFactory ¶
func (p ServiceFactoryProvider) CreateFactory() (ServiceFactory, error)
CreateFactory creates a new factory.
func (ServiceFactoryProvider) GetFactoryConfig ¶
func (p ServiceFactoryProvider) GetFactoryConfig() (ServiceFactoryConfig, error)
GetFactoryConfig returns the factory configuration.
type ServiceInitializer ¶
type ServiceInitializer interface { // GetServices returns the active service kinds. GetServices() []ServiceKind // GetServicesFactories returns the list of the required services factories providers. GetServicesFactories() (map[ServiceKind]ServiceFactoryProvider, error) }
ServiceInitializer is the service initializer.
type ServiceKind ¶
type ServiceKind string
ServiceKind is the type of service.
const ( ServiceAAP ServiceKind = "AAP" ServicePAP ServiceKind = "PAP" ServicePIP ServiceKind = "PIP" ServicePRP ServiceKind = "PRP" ServiceIDP ServiceKind = "IDP" ServicePDP ServiceKind = "PDP" )
func NewServiceKindFromString ¶
func NewServiceKindFromString(service string) (ServiceKind, error)
NewServiceKindFromString creates a new service kind from a string.
func (ServiceKind) Equal ¶
func (s ServiceKind) Equal(service ServiceKind) bool
Equal returns true if the service kind is equal to the input service kind.
func (ServiceKind) IsValid ¶
func (s ServiceKind) IsValid(services []ServiceKind) bool
IsValid returns true if the service kind is valid.
func (ServiceKind) String ¶
func (s ServiceKind) String() string
String returns the string representation of the service kind.
type Serviceable ¶
type Serviceable interface { // GetService returns the service kind. GetService() ServiceKind // GetEndpoints returns the service endpoints. GetEndpoints() ([]EndpointInitializer, error) }
Serviceable must be implemented by all the services.