Documentation ¶
Index ¶
- type Service
- func (s *Service) Broker() broker.Broker
- func (s *Service) Client() client.Client
- func (s *Service) Database() db.ServiceDatabase
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) IterateComponents(ctx context.Context, ...) error
- func (s *Service) KVStore() kvstore.KVStore
- func (s *Service) Logger() logger.Logger
- func (s *Service) Registry() registry.ServiceRegistry
- func (s *Service) Run(ctx context.Context) error
- func (s *Service) Server() server.Server
- func (s *Service) ShutDown(ctx context.Context)
- func (s *Service) Tracer() tracer.Tracer
- type ServiceOption
- func WithBroker(b broker.Broker) ServiceOption
- func WithClient(c client.Client) ServiceOption
- func WithDatabase(database db.ServiceDatabase) ServiceOption
- func WithKVStore(kvStore kvstore.KVStore) ServiceOption
- func WithLogger(l logger.Logger) ServiceOption
- func WithRegistry(r registry.ServiceRegistry) ServiceOption
- func WithServer(srv server.Server) ServiceOption
- func WithTracer(t tracer.Tracer) ServiceOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles config required by the service
func (*Service) Database ¶
func (s *Service) Database() db.ServiceDatabase
Database returns the instance as database.ServiceDatabase
func (*Service) IterateComponents ¶
func (s *Service) IterateComponents( ctx context.Context, cb func(ctx context.Context, key string, comp component.Component) error, ) error
IterateComponents - iterates over all the service components and invokes the callback
func (*Service) Registry ¶
func (s *Service) Registry() registry.ServiceRegistry
Registry returns the instance as registry.ServiceRegistry
type ServiceOption ¶
type ServiceOption func(*Service)
ServiceOption to pass as arg while creating new service
func WithBroker ¶
func WithBroker(b broker.Broker) ServiceOption
WithBroker sets a broker for the service
func WithClient ¶
func WithClient(c client.Client) ServiceOption
WithClient registers the server's client
func WithDatabase ¶
func WithDatabase(database db.ServiceDatabase) ServiceOption
WithDatabase sets the database used by the service
func WithKVStore ¶
func WithKVStore(kvStore kvstore.KVStore) ServiceOption
WithKVStore passes the kvstore used by the service
func WithLogger ¶
func WithLogger(l logger.Logger) ServiceOption
WithLogger sets the logger used by the service
func WithRegistry ¶
func WithRegistry(r registry.ServiceRegistry) ServiceOption
WithRegistry passes services registry externally
func WithTracer ¶
func WithTracer(t tracer.Tracer) ServiceOption
WithTracer assigns the tracer to be used by the service