runner

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultShutdownTimeout = 10 * time.Second

DefaultShutdownTimeout is the timeout period for stopping a container

View Source
const DefaultStartTimeout = 30 * time.Second

DefaultStartTimeout is the timeout period for starting a container

View Source
const MySQLDefaultImage = "mysql:5.7"

MySQLDefaultImage is used if none is specified

View Source
const PostgresDBDefaultImage = "postgres:9.6"

PostgresDBDefaultImage is used if none is specified

Variables

This section is empty.

Functions

func UniqueName

func UniqueName() string

UniqueName generates a random string for a Docker containers name

Types

type MySQL

type MySQL struct {
	Client          *docker.Client
	Image           string
	HostIP          string
	HostPort        int
	Name            string
	ContainerPort   int
	StartTimeout    time.Duration
	ShutdownTimeout time.Duration

	ErrorStream  io.Writer
	OutputStream io.Writer
	// contains filtered or unexported fields
}

MySQL defines a containerized MySQL Server

func (*MySQL) ContainerAddress

func (c *MySQL) ContainerAddress() string

ContainerAddress returns the container address where this MySQL instance is available.

func (*MySQL) ContainerID

func (c *MySQL) ContainerID() string

ContainerID returns the container ID of this MySQL instance

func (*MySQL) GetConnectionString

func (c *MySQL) GetConnectionString() (string, error)

GetConnectionString returns the sql connection string for connecting to the DB

func (*MySQL) HostAddress

func (c *MySQL) HostAddress() string

HostAddress returns the host address where this MySQL instance is available.

func (*MySQL) Run

func (c *MySQL) Run(sigCh <-chan os.Signal, ready chan<- struct{}) error

Run is called by the ifrit runner to start a process

func (*MySQL) Start

func (c *MySQL) Start() error

Start starts the MySQL container using an ifrit runner

func (*MySQL) Stop

func (c *MySQL) Stop() error

Stop stops and removes the MySQL container

type NameFunc

type NameFunc func() string

A NameFunc is used to generate container names.

var DefaultNamer NameFunc = UniqueName

DefaultNamer is the default naming function.

type PostgresDB

type PostgresDB struct {
	Client          *docker.Client
	Image           string
	HostIP          string
	HostPort        int
	Name            string
	ContainerPort   int
	StartTimeout    time.Duration
	ShutdownTimeout time.Duration

	ErrorStream  io.Writer
	OutputStream io.Writer
	// contains filtered or unexported fields
}

PostgresDB defines a containerized Postgres Server

func (*PostgresDB) ContainerAddress

func (c *PostgresDB) ContainerAddress() string

ContainerAddress returns the container address where this PostgresDB instance is available.

func (*PostgresDB) ContainerID

func (c *PostgresDB) ContainerID() string

ContainerID returns the container ID of this PostgresDB

func (*PostgresDB) GetConnectionString

func (c *PostgresDB) GetConnectionString() (string, error)

GetConnectionString returns the sql connection string for connecting to the DB

func (*PostgresDB) HostAddress

func (c *PostgresDB) HostAddress() string

HostAddress returns the host address where this PostgresDB instance is available.

func (*PostgresDB) Run

func (c *PostgresDB) Run(sigCh <-chan os.Signal, ready chan<- struct{}) error

Run is called by the ifrit runner to start a process

func (*PostgresDB) Start

func (c *PostgresDB) Start() error

Start starts the PostgresDB container using an ifrit runner

func (*PostgresDB) Stop

func (c *PostgresDB) Stop() error

Stop stops and removes the PostgresDB container

Jump to

Keyboard shortcuts

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