| 1 | <?php |
| 2 | |
| 3 | namespace Wikimedia\Rdbms; |
| 4 | |
| 5 | use Stringable; |
| 6 | |
| 7 | /** |
| 8 | * An object representing a primary or replica DB position in a replicated setup. |
| 9 | * |
| 10 | * The implementation details of this opaque type are up to the database subclass. |
| 11 | * |
| 12 | * @since 1.37 |
| 13 | */ |
| 14 | interface DBPrimaryPos extends Stringable { |
| 15 | /** |
| 16 | * @since 1.25 |
| 17 | * @return float UNIX timestamp |
| 18 | */ |
| 19 | public function asOfTime(); |
| 20 | |
| 21 | /** |
| 22 | * @since 1.27 |
| 23 | * @param DBPrimaryPos $pos |
| 24 | * @return bool Whether this position is at or higher than $pos |
| 25 | */ |
| 26 | public function hasReached( DBPrimaryPos $pos ); |
| 27 | |
| 28 | /** |
| 29 | * @since 1.27 |
| 30 | * @return string |
| 31 | */ |
| 32 | public function __toString(); |
| 33 | |
| 34 | /** |
| 35 | * Deserialization from storage |
| 36 | * |
| 37 | * @since 1.39 |
| 38 | * @param array $data Representation as returned from ::toArray() |
| 39 | * @return DBPrimaryPos |
| 40 | */ |
| 41 | public static function newFromArray( array $data ); |
| 42 | |
| 43 | /** |
| 44 | * Serialization for storage |
| 45 | * |
| 46 | * @since 1.39 |
| 47 | * @return array Representation for use by ::newFromArray() |
| 48 | */ |
| 49 | public function toArray(): array; |
| 50 | |
| 51 | } |