core

package
v0.0.364 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Deprecated: use ZLog.
	Log  = log.New(os.Stderr, "[ns] ", log.Ldate|log.Ltime|log.Lmicroseconds)
	ZLog = zerolog.New(os.Stderr).With().Timestamp().Logger().Level(zerolog.DebugLevel)
)

Functions

func AssertNotRunning

func AssertNotRunning(what string)

func EnvIs

func EnvIs(purpose schema.Environment_Purpose) bool

func EnvPurpose added in v0.0.180

func EnvPurpose() schema.Environment_Purpose

func InitializationDone

func InitializationDone()

func MarkShutdownStarted added in v0.0.92

func MarkShutdownStarted()

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)

type Checker

type Checker interface {
	Check(context.Context) error
}

func CheckAtStartupFunc added in v0.0.181

func CheckAtStartupFunc(callback func(context.Context) error) Checker

After the checker function returns a nil error, it will always succeed.

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

func (*DependencyGraph) RunPostInitializers added in v0.0.348

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

type Initializer

type Initializer struct {
	Package *Package
	Before  []string
	After   []string
	Do      func(context.Context, Dependencies) error
	DoPost  func(context.Context) 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
	PackageDependencies   []string
	ListenerConfiguration 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, string)

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