Documentation
¶
Index ¶
- Constants
- type Option
- func Context(ctx context.Context) Option
- func Name(n string) Option
- func Version(v string) Option
- func WithBrokerOptions(opts ...broker.Option) Option
- func WithDialOptions(opts ...grpc.DialOption) Option
- func WithGrpcEndpoint(endpoint string) Option
- func WithGrpcOptions(opts ...grpc.ServerOption) Option
- func WithShutdownTimeout(timeout time.Duration) Option
- type Options
- type Remote
- type Service
Constants ¶
View Source
const ( DefaultName = "mkit.service.default" DefaultVersion = "latest" DefaultAddress = ":0" // DefaultShutdownTimeout defines the default timeout given to the service when calling Shutdown. DefaultShutdownTimeout = time.Minute * 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
func Context ¶
Context specifies a context for the service. Can be used to signal shutdown of the service Can be used for extra option values.
func WithBrokerOptions ¶
func WithBrokerOptions(opts ...broker.Option) Option
func WithDialOptions ¶
func WithDialOptions(opts ...grpc.DialOption) Option
func WithGrpcEndpoint ¶
WithGrpcEndpoint specifies the net.Listener endpoint to use instead of the default
func WithGrpcOptions ¶
func WithGrpcOptions(opts ...grpc.ServerOption) Option
func WithShutdownTimeout ¶
type Options ¶
type Options struct {
Name string
Version string
GrpcEndpoint string
GrpcOptions []grpc.ServerOption
DialOptions []grpc.DialOption
BrokerOptions []broker.Option
// ShutdownTimeout defines the timeout given to the http.Server when calling Shutdown.
// If nil, DefaultShutdownTimeout is used.
ShutdownTimeout time.Duration
// Alternative options
Context context.Context
}
type Service ¶
type Service interface {
Options() Options
Server() *grpc.Server
Client(remote Remote) (*grpc.ClientConn, error)
Broker() broker.Broker
ApplyOptions(opts ...Option) // TODO: no use, make private ?
Start() error
Shutdown() error
}
func NewService ¶
NewService creates and returns a new Service based on the packages within.
Click to show internal directories.
Click to hide internal directories.