| 1 | <?php |
||
| 4 | abstract class Data_Source { |
||
| 5 | |||
| 6 | /** |
||
| 7 | * @var string The key which is provided to the background process |
||
| 8 | * in order to retrieve its state, it should be the same as the one provided to |
||
| 9 | * background process. |
||
| 10 | */ |
||
| 11 | private $state_storage_key; |
||
| 12 | |||
| 13 | public function __construct( $state_storage_key ) { |
||
| 16 | |||
| 17 | /** |
||
| 18 | * A list of item ids. |
||
| 19 | * @return int[] |
||
| 20 | */ |
||
| 21 | abstract public function next(); |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The count of total items which needs to be processed. |
||
| 25 | * @return int[] |
||
| 26 | */ |
||
| 27 | abstract public function count(); |
||
| 28 | |||
| 29 | /** |
||
| 30 | * A numerical value indicating how many items should be processed per |
||
| 31 | * background call. |
||
| 32 | * @return int |
||
| 33 | */ |
||
| 34 | abstract public function get_batch_size(); |
||
| 35 | |||
| 36 | |||
| 37 | public function get_state() { |
||
| 45 | |||
| 46 | } |
||
| 47 |