core

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AssertNotRunning

func AssertNotRunning(what string)

func EnvIs

func EnvIs(purpose schema.Environment_Purpose) bool

func InitializationDone

func InitializationDone()

func MustUnwrapProto

func MustUnwrapProto(b64 string, m proto.Message) proto.Message

MustUnwrapProto unserializes a proto from a base64 string. This is used to pack pre-computed protos into a binary, and is never expected to fail.

func ProvideServerInfo

func ProvideServerInfo(ctx context.Context, _ *types.ServerInfoArgs) (*types.ServerInfo, error)

func RegisterDebugEndpoints

func RegisterDebugEndpoints(mux *mux.Router)

func StatusHandler

func StatusHandler(registered []string) http.Handler

func WithResources

func WithResources(ctx context.Context, res *ServerResources) context.Context

Types

type Check

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

func ProvideLivenessCheck

func ProvideLivenessCheck(ctx context.Context, _ *types.LivenessCheckArgs) (Check, error)

func ProvideReadinessCheck

func ProvideReadinessCheck(ctx context.Context, _ *types.ReadinessCheckArgs) (Check, error)

func (Check) Register

func (c Check) Register(name string, check Checker)

By default, a Readiness checker never returns a failure after it becomes valid once. This is by design, we don't want our server to stop receiving traffic in the event of intermittent issues (e.g. we don't want to track whether our dependencies are reachable). To manually control the behavior pass in a `ManualChecker` instead.

func (Check) RegisterFunc

func (c Check) RegisterFunc(name string, check CheckerFunc)

type Checker

type Checker interface {
	Check(context.Context) error
	// contains filtered or unexported methods
}

func ManualChecker

func ManualChecker(check CheckerFunc) Checker

type CheckerFunc

type CheckerFunc func(context.Context) error

func (CheckerFunc) Check

func (c CheckerFunc) Check(ctx context.Context) error

type CtxCloseable

type CtxCloseable interface {
	Close(context.Context) error
}

type DebugHandler

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

func ProvideDebugHandler

func ProvideDebugHandler(ctx context.Context, _ *types.DebugHandlerArgs) (DebugHandler, error)

func (DebugHandler) Handle

func (h DebugHandler) Handle(handler http.Handler)

type Dependencies

type Dependencies interface {
	Instantiate(ctx context.Context, provider Provider, f func(context.Context, interface{}) error) error
}

type DependencyGraph

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

func NewDependencyGraph

func NewDependencyGraph() *DependencyGraph

func (*DependencyGraph) AddInitializers

func (di *DependencyGraph) AddInitializers(init ...*Initializer)

func (*DependencyGraph) Init

func (di *DependencyGraph) Init(ctx context.Context) error

Init is deprecated; use RunInitializers.

func (*DependencyGraph) Instantiate

func (di *DependencyGraph) Instantiate(ctx context.Context, provider Provider, f func(context.Context, interface{}) error) error

func (*DependencyGraph) RunInitializers

func (di *DependencyGraph) RunInitializers(ctx context.Context) error

type Initializer

type Initializer struct {
	Package *Package
	Before  []string
	After   []string
	Do      func(context.Context, Dependencies) error
}

type InstantiationPath

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

func InstantiationPathFromContext

func InstantiationPathFromContext(ctx context.Context) *InstantiationPath

InstantiationPathFromContext returns the InstantiationPath associated with the ctx. If no logger is associated, nil is returned

func (*InstantiationPath) Append

func (*InstantiationPath) Last

func (*InstantiationPath) String

func (ip *InstantiationPath) String() string

func (*InstantiationPath) WithContext

func (ip *InstantiationPath) WithContext(ctx context.Context) context.Context

WithContext returns a copy of ctx with ip associated. If an instance of InstantiationPath is already in the context, the value is overwritten.

type Package

type Package struct {
	PackageName string
}

type Provider

type Provider struct {
	Package     *Package
	Typename    string
	Instantiate func(context.Context, Dependencies) (interface{}, error)
}

type Reference

type Reference struct {
	Package  schema.PackageName
	Typename string
}

type ServerResources

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

func PrepareEnv

func PrepareEnv(specifiedServerName string) *ServerResources

func ServerResourcesFrom

func ServerResourcesFrom(ctx context.Context) *ServerResources

func (*ServerResources) Add

func (sr *ServerResources) Add(closeable CtxCloseable)

func (*ServerResources) Close

func (sr *ServerResources) Close(ctx context.Context) error

Jump to

Keyboard shortcuts

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