postgresql

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package postgresql contains business logic of working with Remote PostgreSQL instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Node    models.RemoteNode
	Service models.PostgreSQLService
}

type Service

type Service struct {
	*ServiceConfig
	// contains filtered or unexported fields
}

Service is responsible for interactions with PostgreSQL.

func NewService

func NewService(config *ServiceConfig) (*Service, error)

NewService creates a new service.

func (*Service) Add

func (svc *Service) Add(ctx context.Context, name, address string, port uint32, username, password string) (int32, error)

Add new postgreSQL service and start postgres_exporter

func (*Service) ApplyPrometheusConfiguration

func (svc *Service) ApplyPrometheusConfiguration(ctx context.Context, q *reform.Querier) error

ApplyPrometheusConfiguration Adds postgres to prometheus configuration and applies it

func (*Service) List

func (svc *Service) List(ctx context.Context) ([]Instance, error)

func (*Service) Remove

func (svc *Service) Remove(ctx context.Context, id int32) error

Remove stops postgres_exporter and agent and remove agent from db

func (*Service) Restore

func (svc *Service) Restore(ctx context.Context, tx *reform.TX) error

Restore configuration from database.

type ServiceConfig

type ServiceConfig struct {
	PostgresExporterPath string

	Prometheus    *prometheus.Service
	Supervisor    services.Supervisor
	DB            *reform.DB
	PortsRegistry *ports.Registry
}

Jump to

Keyboard shortcuts

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