garage

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProviderName = "stats"
)

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) (stats.Provider, error)

func GetEnity

func GetEnity(ctx context.Context, enityName string) (interface{}, error)

func Registrate

func Registrate(ctx context.Context) (context.Context, error)

func RegistrateEnity

func RegistrateEnity(ctx context.Context, enityName string, options interface{}) (context.Context, error)

Types

type Config

type Config struct {
	// HTTPProviderName is a name http server provider for server, where will be
	// handled statistics and metrics requests
	HTTPProviderName string `envconfig:"optional"`
	// HTTPEnityName is a name of http server
	HTTPEnityName string `envconfig:"optional"`
}

Config describes struct with options for Statistics provider

func (*Config) Validate

func (c *Config) Validate()

type Enity

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

Enity is a connection controlling structure. It controls connection, asynchronous queue and everything that related to specified connection.

func GetEnityTypeCast

func GetEnityTypeCast(ctx context.Context, enityName string) (*Enity, error)

func NewEnity

func NewEnity(ctx context.Context, name string, opts interface{}) (*Enity, error)

NewEnity create new enity.

func (*Enity) RegisterAliveCheck

func (e *Enity) RegisterAliveCheck(dependencyName string, checkFunc stats.CheckFunc) error

RegisterAliveCheck should register a function for /health/alive endpoint.

func (*Enity) RegisterMetric

func (e *Enity) RegisterMetric(metricName string, options interface{}) error

RegisterMetric should register a metric of defined type. Passed metricName should be used only as internal identifier. Provider should provide instructions for using metricOptions as well as cast to appropriate type.

func (*Enity) RegisterReadyCheck

func (e *Enity) RegisterReadyCheck(dependencyName string, checkFunc stats.CheckFunc) error

RegisterReadyCheck should register a function for /health/ready endpoint.

func (*Enity) Shutdown

func (e *Enity) Shutdown() error

func (*Enity) Start

func (e *Enity) Start() error

Start should start all things up.

type Provider

type Provider struct {
	*provider.Provider
}

func NewProvider

func NewProvider(ctx context.Context) *Provider

Initialize initializes provider.

func (*Provider) CreateEnity

func (p *Provider) CreateEnity(enityName string, options interface{}) error

CreateEnity should create enity using passed parameters.

func (*Provider) GetEnity

func (p *Provider) GetEnity(connectionName string) (interface{}, error)

GetEnity should return pointer to connection structure to caller.

func (*Provider) RegisterAliveCheck

func (p *Provider) RegisterAliveCheck(dependencyName string, checkFunc stats.CheckFunc) error

RegisterAliveCheck should register a function for /health/alive endpoint. nolint : dupl

func (*Provider) RegisterMetric

func (p *Provider) RegisterMetric(metricName string, options interface{}) error

RegisterMetric should register a metric of defined type. Passed metricName should be used only as internal identifier. Provider should provide instructions for using metricOptions as well as cast to appropriate type.

func (*Provider) RegisterReadyCheck

func (p *Provider) RegisterReadyCheck(dependencyName string, checkFunc stats.CheckFunc) error

RegisterReadyCheck should register a function for /health/ready endpoint. nolint : dupl

Jump to

Keyboard shortcuts

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