services

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Healthcheck is healthcheck service
	Healthcheck = "healthcheck-service"
	// Version is healthcheck service
	Version = "version-service"
	// JWT is jwt issuer service
	JWT = "jwt-service"
	// Keys is keys interface service
	Keys = "keys-service"
)

Variables

View Source
var (
	// ServiceCtxKey is the context.Context key to store the services context
	ServiceCtxKey = &contextKey{"ServiceContext"}
)

Functions

func NewContext

func NewContext(ctx context.Context, init *InitContext) (context.Context, error)

NewContext returns a new service InitContext

Types

type GRPCConfig

type GRPCConfig struct {
	Address        string
	MaxRecvMsgSize int
	MaxSendMsgSize int
}

GRPCConfig holds grpc init info

type GRPCRegisterer

type GRPCRegisterer interface {
	RegisterGRPC(server *grpc.Server) error
}

GRPCRegisterer interface to register grpc services

type InitContext

type InitContext struct {
	KeysRepo        *keys.Repository
	ContEnc         jose.ContentEncryption
	Logger          *zap.Logger
	G               *group.Group
	CancelInterrupt chan struct{}
	GrpcRegisterers []GRPCRegisterer
	ServiceInfos    []*ServiceInfo
	Services        map[string]interface{}
	GRPCConfig
	Metrics

	*sync.RWMutex
}

InitContext is used for service initialization

func FromContext

func FromContext(ctx context.Context) (*InitContext, error)

FromContext returns service *InitContext from context

type Metrics

type Metrics struct {
	MetricsAddr    string
	GRPCHistogram  bool
	DisableMetrics bool
}

Metrics options

type ServiceInfo

type ServiceInfo struct {
	// Type of the plugin
	Type Type
	// ID of the plugin
	ID string
	// Config specific to the plugin
	Config interface{}
	// Requires is a list of plugins that the registered plugin requires to be available
	Requires []Type

	// InitFn is called when initializing a plugin. The registration and
	// context are passed in. The init function may modify the registration to
	// add exports, capabilities and platform support declarations.
	InitFn func(context.Context) (interface{}, error)
	// Disable the plugin from loading
	Disable bool
}

ServiceInfo contains information for registering service

type Type

type Type string

Type is the type of the plugin

const (
	// InternalService implements an internal service
	InternalService Type = "jwtis.internal.v1"
	// GRPCService implements a grpc service
	GRPCService Type = "jwtis.grpc.v1"
)

func (Type) String

func (t Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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