service

package module
v0.0.0-...-40666e8 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: NCSA Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultName = "rai-project/service[default]"
)

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func AfterStart

func AfterStart(fn func() error) Option

func AfterStop

func AfterStop(fn func() error) Option

func BeforeStart

func BeforeStart(fn func() error) Option

func BeforeStop

func BeforeStop(fn func() error) Option

func Context

func Context(ctx context.Context) Option

func Name

func Name(s string) Option

func Registry

func Registry(s registrystore.Store) Option

func ServiceDescription

func ServiceDescription(s grpc.ServiceDesc) Option

func Tracer

func Tracer(s tracer.Tracer) Option

func Using

func Using(e *Options) Option

overrides the default option being used Must be at the beginning of the options

type Options

type Options struct {
	Name        string
	Description grpc.ServiceDesc

	// Register loop interval
	RegisterInterval time.Duration

	// Tracer
	Tracer tracer.Tracer

	// Registry
	Registry registrystore.Store

	// Before and After funcs
	BeforeStart []func() error
	BeforeStop  []func() error
	AfterStart  []func() error
	AfterStop   []func() error

	Context context.Context
}

func NewOptions

func NewOptions(opts ...Option) *Options

type Service

type Service interface {
	Start() error
	Stop() error
	Run() error
}

func New

func New(opts ...Option) (Service, error)

Jump to

Keyboard shortcuts

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