mysql

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: Apache-2.0 Imports: 17 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(mysqlDb MySQL) error

Migrate upgrades a database to the latest database schema version.

func TxDeadlock

func TxDeadlock(err error) bool

TxDeadlock returns true if the error is because of a transaction deadlock

func ViolatesMinTime

func ViolatesMinTime(err error) bool

ViolatesMinTime returns true if the error violates min time between terminations

Types

type MySQL

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

MySQL represents a MySQL-backed store for schedules and terminations

func New

func New(host string, port int, user string, password string, dbname string) (MySQL, error)

New creates a new MySQL

func NewFromConfig

func NewFromConfig(cfg *config.Monkey) (MySQL, error)

NewFromConfig creates a new MySQL taking config parameters from cfg

func (MySQL) Check

func (m MySQL) Check(term chaosmonkey.Termination, appCfg chaosmonkey.AppConfig, endHour int, loc *time.Location) error

Check checks if a termination is permitted and, if so, records the termination time on the server

func (MySQL) CheckWithDelay

func (m MySQL) CheckWithDelay(term chaosmonkey.Termination, appCfg chaosmonkey.AppConfig, endHour int, loc *time.Location, delay time.Duration) error

CheckWithDelay is the same as Check, but adds a delay between reading and writing to the database (used for testing only)

func (MySQL) Close

func (m MySQL) Close() error

Close closes the underlying sql.DB

func (MySQL) Publish

func (m MySQL) Publish(date time.Time, sched *schedule.Schedule) error

Publish publishes the schedule for the given date

func (MySQL) PublishWithDelay

func (m MySQL) PublishWithDelay(date time.Time, sched *schedule.Schedule, delay time.Duration) (err error)

PublishWithDelay publishes the schedule with a delay between checking the schedule exists and writing it. The delay is used only for testing race conditions

func (MySQL) Retrieve

func (m MySQL) Retrieve(date time.Time) (sched *schedule.Schedule, err error)

Retrieve retrieves the schedule for the given date

Jump to

Keyboard shortcuts

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