platform

package module
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 5 Imported by: 1

README

Simple (Cloud) Platform Abstractions

Cloud Platform abstractions and other shared code to build cloud-native services.

Documentation

Index

Constants

View Source
const (
	MsgMissingProvider = "provider '%s' required"
)

Variables

This section is empty.

Functions

func Close added in v2.2.0

func Close() error

Close asks all registered providers of the current default platform instance to gracefully shutdown.

func Logger

func Logger(logID string) provider.LoggingProvider

Logger returns a logger instance identified by ID

func Meter

func Meter(ctx context.Context, metric string, args ...string)

Meter logs args to a metrics log from where the values can be aggregated and analyzed.

func NewHttpContext

func NewHttpContext(req *h.Request) context.Context

NewHttpContext creates a new Http context for request req

func Provider added in v2.6.0

func Provider(providerType provider.ProviderType) (interface{}, bool)

Provider returns the registered provider instance if it is defined. The bool flag is set to true if there is a provider and false otherwise.

func ReportError

func ReportError(e error)

ReportError reports error e using the current platform's error reporting provider

Types

type Platform

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

func DefaultPlatform

func DefaultPlatform() *Platform

DefaultPlatform returns the current default platform provider.

func InitPlatform

func InitPlatform(ctx context.Context, opts ...provider.ProviderConfig) (*Platform, error)

InitPlatform creates a new platform instance and configures it with providers

func RegisterPlatform

func RegisterPlatform(p *Platform) *Platform

RegisterPlatform makes p the new default platform provider

func (*Platform) Close added in v2.2.0

func (p *Platform) Close() error

Close iterates over all registered providers and shuts them down.

func (*Platform) RegisterProviders added in v2.0.3

func (p *Platform) RegisterProviders(ignoreExists bool, opts ...provider.ProviderConfig) error

RegisterProviders registers one or more providers. An existing provider will be overwritten if ignoreExists is true, otherwise the function returns an error.

Directories

Path Synopsis
pkg
api
env
id
provider

Jump to

Keyboard shortcuts

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