<commit_before>/*
   Copyright (c) 2014-2015, Percona LLC and/or its affiliates. All rights reserved.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Affero General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>
*/

package agent

import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
	"time"

	"github.com/percona/cloud-protocol/proto"
	"github.com/percona/percona-agent/pct"
	pctCmd "github.com/percona/percona-agent/pct/cmd"
)

// REV="$(git rev-parse HEAD)"
// go build -ldflags "-X github.com/percona/percon-agent/agnet.REVISION $REV"
var REVISION string = "0"
var VERSION string = "1.0.10"
var REL string = ""
var MIN_SUPPORTED_MYSQL_VERSION = "5.1.0"

const (
	CMD_QUEUE_SIZE    = 10
	STATUS_QUEUE_SIZE = 10
	MAX_ERRORS        = 3
)

type Agent struct {
	config    *Config
	configMux *sync.RWMutex
	configDir string
	logger    *pct.Logger
	client    pct.WebsocketClient
	api       pct.APIConnector
	services  map[string]pct.ServiceManager
	updater   *pct.Updater
	keepalive *time.Ticker
	// --
	cmdSync        *pct.SyncChan
	cmdChan        chan *proto.Cmd
	cmdHandlerSync *pct.SyncChan
	//
	statusSync        *pct.SyncChan
	status            *pct.Status
	statusChan        chan *proto.Cmd<commit_msg>Bump VERSION to 1.0.11.<commit_after>/*
   Copyright (c) 2014-2015, Percona LLC and/or its affiliates. All rights reserved.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU Affero General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Affero General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>
*/

package agent

import (
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
	"time"

	"github.com/percona/cloud-protocol/proto"
	"github.com/percona/percona-agent/pct"
	pctCmd "github.com/percona/percona-agent/pct/cmd"
)

// REV="$(git rev-parse HEAD)"
// go build -ldflags "-X github.com/percona/percon-agent/agnet.REVISION $REV"
var REVISION string = "0"
var VERSION string = "1.0.11"
var REL string = ""
var MIN_SUPPORTED_MYSQL_VERSION = "5.1.0"

const (
	CMD_QUEUE_SIZE    = 10
	STATUS_QUEUE_SIZE = 10
	MAX_ERRORS        = 3
)

type Agent struct {
	config    *Config
	configMux *sync.RWMutex
	configDir string
	logger    *pct.Logger
	client    pct.WebsocketClient
	api       pct.APIConnector
	services  map[string]pct.ServiceManager
	updater   *pct.Updater
	keepalive *time.Ticker
	// --
	cmdSync        *pct.SyncChan
	cmdChan        chan *proto.Cmd
	cmdHandlerSync *pct.SyncChan
	//
	statusSync        *pct.SyncChan
	status            *pct.Status
	statusChan        chan *proto.Cmd
{'fraction_non_alphanumeric': 0.08873626373626374, 'fraction_numerical': 0.013186813186813187, 'mean_word_length': 3.189873417721519, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1146298', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1236, 'n_words': 394}