tools

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package tools provides helpers to initialize data.

Index

Constants

View Source
const (
	// DataStateAtFormat describes format of dataStateAt.
	DataStateAtFormat = "20060102150405"
)
View Source
const (

	// ViewLogsCmd tells the command to view docker container logs.
	ViewLogsCmd = "docker logs --since 1m -f"
)

Variables

This section is empty.

Functions

func AddVolumesToHostConfig

func AddVolumesToHostConfig(ctx context.Context, docker *client.Client, hostConfig *container.HostConfig, dataDir string) error

AddVolumesToHostConfig adds volumes to container host configuration depends on process environment.

func CheckContainerReadiness

func CheckContainerReadiness(ctx context.Context, dockerClient *client.Client, containerID string) (err error)

CheckContainerReadiness checks health and reports if container is ready.

func DetectPGVersion

func DetectPGVersion(dataDir string) (float64, error)

DetectPGVersion defines PostgreSQL version of PGDATA.

func DiscoverDataStateAt

func DiscoverDataStateAt(input io.Reader) (string, error)

DiscoverDataStateAt scans input data and discovers time when the archive is created.

func ExecCommand

func ExecCommand(ctx context.Context, dockerClient *client.Client, containerID string, execCfg types.ExecConfig) error

ExecCommand runs command in Docker container.

func ExecCommandWithOutput

func ExecCommandWithOutput(ctx context.Context, dockerClient *client.Client, containerID string, execCfg types.ExecConfig) (string, error)

ExecCommandWithOutput runs command in Docker container and returns the command output.

func GeneratePassword

func GeneratePassword() (string, error)

GeneratePassword generates a new password.

func GetMountsFromMountPoints

func GetMountsFromMountPoints(dataDir string, mountPoints []types.MountPoint) []mount.Mount

GetMountsFromMountPoints creates a list of mounts.

func IsEmptyDirectory

func IsEmptyDirectory(dir string) (bool, error)

IsEmptyDirectory checks whether a directory is empty.

func PrintContainerLogs

func PrintContainerLogs(ctx context.Context, dockerClient *client.Client, containerID string)

PrintContainerLogs prints container output.

func PullImage

func PullImage(ctx context.Context, dockerClient *client.Client, image string) error

PullImage pulls a Docker image.

func RemoveContainer

func RemoveContainer(ctx context.Context, dockerClient *client.Client, containerID string, stopTimeout time.Duration)

RemoveContainer stops and removes container.

func StopContainer

func StopContainer(ctx context.Context, dockerClient *client.Client, containerID string, stopTimeout time.Duration)

StopContainer stops container.

func StopPostgres

func StopPostgres(ctx context.Context, dockerClient *client.Client, containerID, dataDir string) error

StopPostgres stops Postgres inside container.

func TouchFile

func TouchFile(filename string) error

TouchFile creates an empty file.

Types

This section is empty.

Directories

Path Synopsis
Package cont provides tools to manage service containers started by Database Lab Engine.
Package cont provides tools to manage service containers started by Database Lab Engine.
Package defaults contains default values.
Package defaults contains default values.
Package fs provides tools for working with the filesystem.
Package fs provides tools for working with the filesystem.
Package health provides tools to set up container health check options.
Package health provides tools to set up container health check options.

Jump to

Keyboard shortcuts

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