Documentation ¶
Overview ¶
Package tools provides helpers to initialize data.
Index ¶
- Constants
- func AddVolumesToHostConfig(ctx context.Context, docker *client.Client, hostConfig *container.HostConfig, ...) error
- func CheckContainerReadiness(ctx context.Context, dockerClient *client.Client, containerID string) (err error)
- func DetectPGVersion(dataDir string) (float64, error)
- func DiscoverDataStateAt(input io.Reader) (string, error)
- func ExecCommand(ctx context.Context, dockerClient *client.Client, containerID string, ...) error
- func ExecCommandWithOutput(ctx context.Context, dockerClient *client.Client, containerID string, ...) (string, error)
- func GeneratePassword() (string, error)
- func GetMountsFromMountPoints(dataDir string, mountPoints []types.MountPoint) []mount.Mount
- func InitDB(ctx context.Context, dockerClient *client.Client, containerID string) error
- func IsEmptyDirectory(dir string) (bool, error)
- func LsContainerDirectory(ctx context.Context, dockerClient *client.Client, containerID, dir string) ([]string, error)
- func MakeDir(ctx context.Context, dockerClient *client.Client, dumpContID, dataDir string) error
- func PrintContainerLogs(ctx context.Context, dockerClient *client.Client, containerID string)
- func PrintLastPostgresLogs(ctx context.Context, dockerClient *client.Client, ...)
- func PullImage(ctx context.Context, dockerClient *client.Client, image string) error
- func RemoveContainer(ctx context.Context, dockerClient *client.Client, containerID string, ...)
- func StartPostgres(ctx context.Context, dockerClient *client.Client, containerID string, ...) error
- func StopContainer(ctx context.Context, dockerClient *client.Client, containerID string, ...)
- func StopPostgres(ctx context.Context, dockerClient *client.Client, containerID, dataDir string, ...) error
- func TouchFile(filename string) error
- func TrimPort(hostname string) string
- type ErrHealthCheck
Constants ¶
const ( // DefaultStopTimeout defines the default timeout for Postgres stop. DefaultStopTimeout = 600 // ViewLogsCmd tells the command to view docker container logs. ViewLogsCmd = "docker logs --since 1m -f" )
const (
// DataStateAtFormat describes format of dataStateAt.
DataStateAtFormat = "20060102150405"
)
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 ¶
DetectPGVersion defines PostgreSQL version of PGDATA.
func DiscoverDataStateAt ¶
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 ¶
GeneratePassword generates a new password.
func GetMountsFromMountPoints ¶
func GetMountsFromMountPoints(dataDir string, mountPoints []types.MountPoint) []mount.Mount
GetMountsFromMountPoints creates a list of mounts.
func IsEmptyDirectory ¶
IsEmptyDirectory checks whether a directory is empty.
func LsContainerDirectory ¶
func LsContainerDirectory(ctx context.Context, dockerClient *client.Client, containerID, dir string) ([]string, error)
LsContainerDirectory lists content of the directory in a container.
func PrintContainerLogs ¶
PrintContainerLogs prints container output.
func PrintLastPostgresLogs ¶
func PrintLastPostgresLogs(ctx context.Context, dockerClient *client.Client, containerID, clonePath string)
PrintLastPostgresLogs prints Postgres container logs.
func RemoveContainer ¶
func RemoveContainer(ctx context.Context, dockerClient *client.Client, containerID string, stopTimeout time.Duration)
RemoveContainer stops and removes container.
func StartPostgres ¶
func StartPostgres(ctx context.Context, dockerClient *client.Client, containerID string, timeout int) error
StartPostgres stops Postgres inside container.
func StopContainer ¶
func StopContainer(ctx context.Context, dockerClient *client.Client, containerID string, stopTimeout time.Duration)
StopContainer stops container.
Types ¶
type ErrHealthCheck ¶
ErrHealthCheck defines a health check errors.
func (*ErrHealthCheck) Error ¶
func (e *ErrHealthCheck) Error() string
Error prints a health check error.
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 db provides database helpers.
|
Package db provides database helpers. |
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. |
Package pgtool provides tools to run PostgreSQL-specific commands.
|
Package pgtool provides tools to run PostgreSQL-specific commands. |