5 use InvalidArgumentException;
33 $this->gtids = array_map(
'trim', explode(
',', $gtid ) );
41 return "{$this->file}/{$this->pos}";
49 if ( !(
$pos instanceof
self ) ) {
50 throw new InvalidArgumentException(
"Position not an instance of " . __CLASS__ );
55 $thatPosByDomain =
$pos->getGtidCoordinates();
56 if ( $thisPosByDomain && $thatPosByDomain ) {
59 foreach ( $thatPosByDomain
as $domain => $thatPos ) {
60 $thisPos = isset( $thisPosByDomain[$domain] ) ? $thisPosByDomain[$domain] : -1;
61 $reached = $reached && ( $thatPos <= $thisPos );
69 $thatBinPos =
$pos->getBinlogCoordinates();
70 if ( $thisBinPos && $thatBinPos && $thisBinPos[
'binlog'] === $thatBinPos[
'binlog'] ) {
71 return ( $thisBinPos[
'pos'] >= $thatBinPos[
'pos'] );
79 if ( !(
$pos instanceof
self ) ) {
80 throw new InvalidArgumentException(
"Position not an instance of " . __CLASS__ );
85 $thatPosDomains = array_keys(
$pos->getGtidCoordinates() );
86 if ( $thisPosDomains && $thatPosDomains ) {
88 return !array_diff( $thatPosDomains, $thisPosDomains );
93 $thatBinPos =
$pos->getBinlogCoordinates();
95 return ( $thisBinPos && $thatBinPos && $thisBinPos[
'binlog'] === $thatBinPos[
'binlog'] );
106 foreach ( $this->gtids
as $gtid ) {
109 if ( preg_match(
'!^(\d+)-\d+-(\d+)$!', $gtid, $m ) ) {
110 $gtidInfos[(int)$m[1]] = (
int)$m[2];
112 } elseif ( preg_match(
'!^(\w{8}-\w{4}-\w{4}-\w{4}-\w{12}):(\d+)$!', $gtid, $m ) ) {
113 $gtidInfos[$m[1]] = (int)$m[2];
131 if ( preg_match(
'!^(.+)\.(\d+)/(\d+)$!', (
string)$this, $m ) ) {
132 return [
'binlog' => $m[1],
'pos' => [ (int)$m[2], (
int)$m[3] ] ];