orchestrator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package orchestrator note NOTE that this code is copied from: https://github.com/github/orchestrator/blob/master/go/inst/instance.go We need just the types that's why is copied instead of imported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound added in v0.2.4

func IsNotFound(err error) bool

IsNotFound checks if the given error is orchestrator error and it's cluster not found.

Types

type BinlogCoordinates

type BinlogCoordinates struct {
	LogFile string
	LogPos  int64
	Type    BinlogType
}

BinlogCoordinates described binary log coordinates in the form of log file & log position.

type BinlogType

type BinlogType int

BinlogType can be BinaryLog or RelayLog

const (
	// BinaryLog represents mysql binary logs
	BinaryLog BinlogType = iota
	// RelayLog represents mysql relay logs
	RelayLog
)

type CandidatePromotionRule

type CandidatePromotionRule string

CandidatePromotionRule describe the promotion preference/rule for an instance. It maps to promotion_rule column in candidate_database_instance

const (
	MustPromoteRule      CandidatePromotionRule = "must"
	PreferPromoteRule    CandidatePromotionRule = "prefer"
	NeutralPromoteRule   CandidatePromotionRule = "neutral"
	PreferNotPromoteRule CandidatePromotionRule = "prefer_not"
	MustNotPromoteRule   CandidatePromotionRule = "must_not"
)

nolint: golint

type Error added in v0.2.4

type Error struct {
	HTTPStatus int
	Path       string
	Message    string
	Details    interface{}
}

Error contains orchestrator error details

func NewError added in v0.2.4

func NewError(resp *http.Response, path string, details interface{}) *Error

NewError returns a specific orchestrator error with extra details

func NewErrorMsg added in v0.2.4

func NewErrorMsg(msg string, path string) *Error

NewErrorMsg returns an orchestrator error with extra msg

func (Error) Error added in v0.2.4

func (e Error) Error() string

type Instance

type Instance struct {
	Key                    InstanceKey
	InstanceAlias          string
	Uptime                 uint
	ServerID               uint
	ServerUUID             string
	Version                string
	VersionComment         string
	FlavorName             string
	ReadOnly               bool
	Binlog_format          string
	BinlogRowImage         string
	LogBinEnabled          bool
	LogSlaveUpdatesEnabled bool
	SelfBinlogCoordinates  BinlogCoordinates
	MasterKey              InstanceKey
	IsDetachedMaster       bool
	Slave_SQL_Running      bool
	Slave_IO_Running       bool
	HasReplicationFilters  bool
	GTIDMode               string
	SupportsOracleGTID     bool
	UsingOracleGTID        bool
	UsingMariaDBGTID       bool
	UsingPseudoGTID        bool
	ReadBinlogCoordinates  BinlogCoordinates
	ExecBinlogCoordinates  BinlogCoordinates
	IsDetached             bool
	RelaylogCoordinates    BinlogCoordinates
	LastSQLError           string
	LastIOError            string
	SecondsBehindMaster    sql.NullInt64
	SQLDelay               uint
	ExecutedGtidSet        string
	GtidPurged             string

	SlaveLagSeconds sql.NullInt64
	//SlaveHosts                      InstanceKeyMap
	ClusterName                     string
	SuggestedClusterAlias           string
	DataCenter                      string
	PhysicalEnvironment             string
	ReplicationDepth                uint
	IsCoMaster                      bool
	HasReplicationCredentials       bool
	ReplicationCredentialsAvailable bool
	SemiSyncEnforced                bool
	SemiSyncMasterEnabled           bool
	SemiSyncReplicaEnabled          bool

	LastSeenTimestamp    string
	IsLastCheckValid     bool
	IsUpToDate           bool
	IsRecentlyChecked    bool
	SecondsSinceLastSeen sql.NullInt64
	CountMySQLSnapshots  int

	// Careful. IsCandidate and PromotionRule are used together
	// and probably need to be merged. IsCandidate's value may
	// be picked up from daabase_candidate_instance's value when
	// reading an instance from the db.
	IsCandidate          bool
	PromotionRule        CandidatePromotionRule
	IsDowntimed          bool
	DowntimeReason       string
	DowntimeOwner        string
	DowntimeEndTimestamp string
	ElapsedDowntime      time.Duration
	UnresolvedHostname   string
	AllowTLS             bool

	LastDiscoveryLatency time.Duration
}

Instance represents the main structure that an node is represented in orchestrator nolint: golint,maligned

type InstanceKey

type InstanceKey struct {
	Hostname string
	Port     int
}

InstanceKey is the node key

type InstanceKeyMap

type InstanceKeyMap map[InstanceKey]bool

InstanceKeyMap is a convenience struct for listing InstanceKey-s

type Interface

type Interface interface {
	Discover(host string, port int) error
	Forget(host string, port int) error

	Master(clusterHint string) (*Instance, error)

	Cluster(cluster string) ([]Instance, error)

	AuditRecovery(cluster string) ([]TopologyRecovery, error)
	AckRecovery(id int64, commnet string) error

	SetHostWritable(key InstanceKey) error
	SetHostReadOnly(key InstanceKey) error

	BeginMaintenance(key InstanceKey, owner, reason string) error
	EndMaintenance(key InstanceKey) error
	Maintenance() ([]Maintenance, error)
}

Interface is the orchestrator client interface

func NewFromURI

func NewFromURI(uri string) Interface

NewFromURI returns the orchestrator client configured to specified uri api endpoint

type Maintenance

type Maintenance struct {
	MaintenanceId  uint
	Key            InstanceKey
	BeginTimestamp string
	SecondsElapsed uint
	IsActive       bool
	Owner          string
	Reason         string
}

Maintenance indicates a maintenance entry (also in the database) nolint: golint

type TopologyRecovery

type TopologyRecovery struct {
	Id                     int64
	UID                    string
	SuccessorKey           *InstanceKey
	SuccessorAlias         string
	IsActive               bool
	IsSuccessful           bool
	AllErrors              []string
	RecoveryStartTimestamp string
	RecoveryEndTimestamp   string
	ProcessingNodeHostname string
	ProcessingNodeToken    string
	Acknowledged           bool
	AcknowledgedAt         string
	AcknowledgedBy         string
	AcknowledgedComment    string
	LastDetectionId        int64
	RelatedRecoveryId      int64
}

TopologyRecovery is the structure from orchestrator that represents a recovery nolint: golint,maligned

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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