wiki.techinc.nl/includes/libs/rdbms/database/position/DBMasterPos.php
Aaron Schulz 26d87a26fe rdbms: make DBMasterPos implement Serializable
ChronologyProtector uses these classes to briefly store positions
and everytime the fields change then errors can happen when old
values are unserialized and used. Use a simple two-element map
format for serialized positions. The fields are recomputed back
from the data map.

Values from before this change will issue the warning
"Erroneous data format for unserializing". To avoid that, bump
the ChronologyProtector key version. Future field changes will
not require this.

This change should be deployed on all wikis at once.

Bug: T187942
Change-Id: I71bbbc9b9d4c7e02ac02f1d8750b70bda08d4db1
2018-02-23 12:46:28 -08:00

38 lines
802 B
PHP

<?php
namespace Wikimedia\Rdbms;
use Serializable;
/**
* An object representing a master or replica DB position in a replicated setup.
*
* The implementation details of this opaque type are up to the database subclass.
*/
interface DBMasterPos extends Serializable {
/**
* @return float UNIX timestamp
* @since 1.25
*/
public function asOfTime();
/**
* @param DBMasterPos $pos
* @return bool Whether this position is at or higher than $pos
* @since 1.27
*/
public function hasReached( DBMasterPos $pos );
/**
* @param DBMasterPos $pos
* @return bool Whether this position appears to be for the same channel as another
* @since 1.27
*/
public function channelsMatch( DBMasterPos $pos );
/**
* @return string
* @since 1.27
*/
public function __toString();
}