* The LoadMonitor interface is now ILoadMonitor. * Nothing in this code was MySQL specific. Now any DB type can benefit from a LoadMonitor. Change-Id: I272a72cd55a70f99a866d518d44cb3bcaca91b9e
65 lines
2 KiB
PHP
65 lines
2 KiB
PHP
<?php
|
|
/**
|
|
* Database load monitoring interface
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
*
|
|
* @file
|
|
* @ingroup Database
|
|
*/
|
|
use Psr\Log\LoggerAwareInterface;
|
|
|
|
/**
|
|
* An interface for database load monitoring
|
|
*
|
|
* @ingroup Database
|
|
*/
|
|
interface ILoadMonitor extends LoggerAwareInterface {
|
|
/**
|
|
* Construct a new LoadMonitor with a given LoadBalancer parent
|
|
*
|
|
* @param ILoadBalancer $lb LoadBalancer this instance serves
|
|
* @param BagOStuff $sCache Local server memory cache
|
|
* @param BagOStuff $cCache Local cluster memory cache
|
|
*/
|
|
public function __construct( ILoadBalancer $lb, BagOStuff $sCache, BagOStuff $cCache );
|
|
|
|
/**
|
|
* Perform pre-connection load ratio adjustment.
|
|
* @param int[] &$loads
|
|
* @param string|bool $group The selected query group. Default: false
|
|
* @param string|bool $domain Default: false
|
|
*/
|
|
public function scaleLoads( &$loads, $group = false, $domain = false );
|
|
|
|
/**
|
|
* Get an estimate of replication lag (in seconds) for each server
|
|
*
|
|
* Values may be "false" if replication is too broken to estimate
|
|
*
|
|
* @param integer[] $serverIndexes
|
|
* @param string $domain
|
|
*
|
|
* @return array Map of (server index => float|int|bool)
|
|
*/
|
|
public function getLagTimes( $serverIndexes, $domain );
|
|
|
|
/**
|
|
* Clear any process and persistent cache of lag times
|
|
* @since 1.27
|
|
*/
|
|
public function clearCaches();
|
|
}
|