Documentation
¶
Index ¶
- Constants
- Variables
- func AtLeastVersion(v1, v2 string) (bool, error)
- func Bytes(bytes uint64) string
- func Duration(s float64) string
- func FileExists(file string) bool
- func FileSize(fileName string) (int64, error)
- func MakeDir(dir string) error
- func MakeStartLock() error
- func Mbps(bytes uint64, seconds float64) string
- func Ping(hostname, apiKey string, headers map[string]string) (int, error)
- func RemoveFile(file string) error
- func SameFile(file1, file2 string) (bool, error)
- func TimeString(t time.Time) string
- func TimeoutDialer(config *TimeoutClientConfig) func(net, addr string) (c net.Conn, err error)
- func URL(hostname string, paths ...string) string
- func VersionStringToInts(version string) (int64, int64, int64)
- func WaitStartLock() error
- type API
- func (a *API) AgentLink(resource string) string
- func (a *API) AgentUuid() string
- func (a *API) ApiKey() string
- func (a *API) Connect(hostname, apiKey, agentUuid string) error
- func (a *API) EntryLink(resource string) string
- func (a *API) Get(apiKey, url string) (int, []byte, error)
- func (a *API) Hostname() string
- func (a *API) Init(hostname string, apiKey string, headers map[string]string) (int, error)
- func (a *API) Origin() string
- func (a *API) Post(apiKey, url string, data []byte) (*http.Response, []byte, error)
- func (a *API) Put(apiKey, url string, data []byte) (*http.Response, []byte, error)
- func (a *API) URL(paths ...string) string
- type APIConnector
- type Backoff
- type CmdRejectedError
- type CmdTimeoutError
- type DuplicateServiceInstanceError
- type InvalidServiceInstanceError
- type Logger
- func (l *Logger) Debug(entry ...interface{})
- func (l *Logger) DebugOffline(entry ...interface{})
- func (l *Logger) Error(entry ...interface{})
- func (l *Logger) Fatal(entry ...interface{})
- func (l *Logger) Info(entry ...interface{})
- func (l *Logger) LogChan() chan *proto.LogEntry
- func (l *Logger) Service() string
- func (l *Logger) Warn(entry ...interface{})
- type PidFile
- type QueueFullError
- type ServiceIsNotRunningError
- type ServiceIsRunningError
- type ServiceManager
- type Status
- type StatusReporter
- type SyncChan
- type TimeoutClientConfig
- type UnknownCmdError
- type UnknownServiceError
- type UnknownServiceInstanceError
- type Updater
- type WebsocketClient
Constants ¶
View Source
const ( DEFAULT_BASEDIR = "/usr/local/percona/percona-agent" CONFIG_FILE_SUFFIX = ".conf" // Relative to Basedir.path: CONFIG_DIR = "config" DATA_DIR = "data" BIN_DIR = "bin" TRASH_DIR = "trash" START_LOCK = "start.lock" START_SCRIPT = "start.sh" )
Variables ¶
View Source
var Basedir basedir
View Source
var PublicKey = []byte(`-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA3Ks0r5mrqcxOj95VLyCC
JGkilUyyqIwK9YANtf1qOghQHM4qR1g22c+4iLalzcKuf7fRFWyEOmthUMJEdaPN
k3bHTvqBOVsKigq1Yjydlrk3uIvCBLA37HbHKqM7Uq3vPG25GGxv3wI6NbS1fJOO
VnX0gUYTEiQrbv5OjSBBX/A1mj2RBbSVmHbRSwogFGrxEcz+cn8ulDp+8BOtUHmj
/4FY4IXjeLHihBv/q4TQrO3m0CSig3hmfPJiGpWFdxO5dldb8HN1L+P2EsI6xSxo
5Rk48UbIRBgZjZKQcRCacM0V4Co+HxmtXQkrNIf7jdX6iYXPUD/c8+k7rM1eLgEQ
5jNKQEAiLBdB8ZhDtA4MgFHu8ygwEdYtydo0zLqU0EmtpdmUqnVidudaqVFSiC2Q
KAlH5+r/arnC47cwxa4XletbFzEUcw8sC8ZeqWRSC4EGBJI3fgxoikXsarDQ+uoo
9Hy7jB6XbSGgOJE8Spw3q39DQsB2l7sBliEvi5cl1svRMwrNrTd4A2juAze/GQ+B
tqLJb/FMM1F7LaCl8nLDTf1jPav1/BN5u2y893gX8e48MyUaDtzdiT5HMzMaGkIc
IaY4e/7W5A+S1qCWV0AXTawBgcorRCnUucIjrq6canVZj7BdZpADysRzMib8fS8O
3ca1+bu7FtdcwOTpZusdRfUCAwEAAQ==
-----END PUBLIC KEY-----`)
Functions ¶
func AtLeastVersion ¶ added in v1.0.13
func FileExists ¶
func MakeStartLock ¶
func MakeStartLock() error
func RemoveFile ¶
func TimeString ¶ added in v1.0.10
func TimeoutDialer ¶
func TimeoutDialer(config *TimeoutClientConfig) func(net, addr string) (c net.Conn, err error)
func WaitStartLock ¶
func WaitStartLock() error
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
type APIConnector ¶
type APIConnector interface { Connect(hostname, apiKey, agentUuid string) error Init(hostname, apiKey string, headers map[string]string) (code int, err error) Get(apiKey, url string) (int, []byte, error) Post(apiKey, url string, data []byte) (*http.Response, []byte, error) Put(apiKey, url string, data []byte) (*http.Response, []byte, error) EntryLink(resource string) string AgentLink(resource string) string Origin() string Hostname() string ApiKey() string AgentUuid() string URL(paths ...string) string }
type Backoff ¶
func NewBackoff ¶
type CmdRejectedError ¶
func (CmdRejectedError) Error ¶
func (e CmdRejectedError) Error() string
type CmdTimeoutError ¶
type CmdTimeoutError struct {
Cmd string
}
func (CmdTimeoutError) Error ¶
func (e CmdTimeoutError) Error() string
type DuplicateServiceInstanceError ¶
func (DuplicateServiceInstanceError) Error ¶
func (e DuplicateServiceInstanceError) Error() string
type InvalidServiceInstanceError ¶
func (InvalidServiceInstanceError) Error ¶
func (e InvalidServiceInstanceError) Error() string
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) DebugOffline ¶
func (l *Logger) DebugOffline(entry ...interface{})
type PidFile ¶
type PidFile struct {
// contains filtered or unexported fields
}
func NewPidFile ¶
func NewPidFile() *PidFile
type QueueFullError ¶
func (QueueFullError) Error ¶
func (e QueueFullError) Error() string
type ServiceIsNotRunningError ¶
type ServiceIsNotRunningError struct {
Service string
}
func (ServiceIsNotRunningError) Error ¶
func (e ServiceIsNotRunningError) Error() string
type ServiceIsRunningError ¶
type ServiceIsRunningError struct {
Service string
}
func (ServiceIsRunningError) Error ¶
func (e ServiceIsRunningError) Error() string
type ServiceManager ¶
type StatusReporter ¶
type SyncChan ¶
type SyncChan struct { StartChan chan bool StopChan chan bool DoneChan chan bool CrashChan chan bool Crash bool }
func NewSyncChan ¶
func NewSyncChan() *SyncChan
func (*SyncChan) IsGraceful ¶
type TimeoutClientConfig ¶
type UnknownCmdError ¶
type UnknownCmdError struct {
Cmd string
}
func (UnknownCmdError) Error ¶
func (e UnknownCmdError) Error() string
type UnknownServiceError ¶
type UnknownServiceError struct {
Service string
}
func (UnknownServiceError) Error ¶
func (e UnknownServiceError) Error() string
type UnknownServiceInstanceError ¶
func (UnknownServiceInstanceError) Error ¶
func (e UnknownServiceInstanceError) Error() string
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
func NewUpdater ¶
func NewUpdater(logger *Logger, api APIConnector, pubKey []byte, currentBin, currentVersion string) *Updater
type WebsocketClient ¶
type WebsocketClient interface { Conn() *websocket.Conn Status() map[string]string // Cmd/Reply chans: Start() // start the send/recv chans Stop() // stop the send/recv chans manually RecvChan() chan *proto.Cmd // get the (recv) cmdChan SendChan() chan *proto.Reply // get the (send) replyChan // Async connect: Connect() // try forever to connect, notify via ConnectChan Disconnect() error // disconnect manually, notify via ConnectChan ConnectChan() chan bool // true on connect, false on disconnect ErrorChan() chan error // get err from send/recv chans // Sync connect: ConnectOnce(timeout uint) error DisconnectOnce() error // Data transfer: SendBytes(data []byte, timeout uint) error // send data (data/sender) Recv(data interface{}, timeout uint) error // recv proto.Response (data/sender) Send(data interface{}, timeout uint) error // send proto.LogEntry (log/relay) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.