core

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 21 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Name is set at the build time
	Name = ""

	// Version is set at the build time
	Version = ""

	// BuildID is set at the build time
	BuildID = ""

	// CommitSha is set at the build time
	CommitSha = ""

	// BranchName is set at the build time
	BranchName = ""

	// TagName is set at the build time
	TagName = ""
)

Functions

func BuildDownstreamHTTPClient

func BuildDownstreamHTTPClient(serviceName string, cfg *config.CommonDownstreamData) (*http.Client, error)

func Recoverer

func Recoverer(logger *logrus.Logger) func(http.Handler) http.Handler

func SelectBasePath

func SelectBasePath(fromSpec, dynamic string) string

SelectBasePath chooses between a specified base path and a dynmaically chosen one

func Server

func Server(ctx context.Context, name string, hl Manager, grpcHl GrpcManager, logger *logrus.Logger, promRegistry *prometheus.Registry) error

Types

type GrpcGenCallback added in v0.4.0

type GrpcGenCallback interface {
	DownstreamTimeoutContext(ctx context.Context) (context.Context, context.CancelFunc)
}

GrpcGenCallback is currently a subset of RestGenCallback so is defined separately for convenience

type GrpcManager

type GrpcManager interface {
	Interceptors() []grpc.UnaryServerInterceptor
	EnabledGrpcHandlers() []handlerinitialiser.GrpcHandlerInitialiser
	GrpcAdminServerConfig() *config.CommonServerConfig
	GrpcPublicServerConfig() *config.CommonServerConfig
}

type Manager

type Manager interface {
	EnabledHandlers() []handlerinitialiser.HandlerInitialiser
	LibraryConfig() *config.LibraryConfig
	AdminServerConfig() *config.CommonHTTPServerConfig
	PublicServerConfig() *config.CommonHTTPServerConfig
}

type RestGenCallback added in v0.4.0

type RestGenCallback interface {
	// AddMiddleware allows hand-crafted code to add middleware to the router
	AddMiddleware(ctx context.Context, r chi.Router)
	// BasePath allows hand-crafted code to set the base path for the Router
	BasePath() string
	// Config returns a structure representing the server config
	// This is returned from the status endpoint
	Config() interface{}
	// MapError maps an error to an HTTPError in instances where custom error mapping is required. Return nil to perform default error mapping; defined as:
	// 1. CustomError.HTTPError if the original error is a CustomError, otherwise
	// 2. common.MapError
	MapError(ctx context.Context, err error) *common.HTTPError
	// DownstreamTimeoutContext add the desired timeout duration to the context for downstreams
	// A separate service timeout (usually greater than the downstream) should also be in
	// place to automatically respond to callers
	DownstreamTimeoutContext(ctx context.Context) (context.Context, context.CancelFunc)
}

RestGenCallback is used by `sysl-go` to call hand-crafted code

type ServerOption added in v0.24.0

type ServerOption interface {
	// contains filtered or unexported methods
}

func WithGrpcManager added in v0.24.0

func WithGrpcManager(manager GrpcManager) ServerOption

func WithLogrusLogger added in v0.24.0

func WithLogrusLogger(logger *logrus.Logger) ServerOption

func WithPrometheusRegistry added in v0.24.0

func WithPrometheusRegistry(prometheusRegistry *prometheus.Registry) ServerOption

func WithRestManager added in v0.24.0

func WithRestManager(manager Manager) ServerOption

type ServerParams added in v0.24.0

type ServerParams struct {
	Ctx  context.Context
	Name string
	// contains filtered or unexported fields
}

func NewServerParams added in v0.24.0

func NewServerParams(ctx context.Context, name string, opts ...ServerOption) *ServerParams

func (*ServerParams) Start added in v0.24.0

func (params *ServerParams) Start() error

type TLSLogFilter

type TLSLogFilter struct {
	// contains filtered or unexported fields
}

func (*TLSLogFilter) Write

func (t *TLSLogFilter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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