interface.jetpack-sync-replicastore.php
| 1 | <?php |
| 2 | /** |
| 3 | * Sync architecture prototype |
| 4 | * |
| 5 | * @author Dan Walmsley |
| 6 | * To run tests: phpunit --testsuite sync --filter New_Sync |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * A high-level interface for objects that store synced WordPress data |
| 11 | * Useful for ensuring that different storage mechanisms implement the |
| 12 | * required semantics for storing all the data that we sync |
| 13 | */ |
| 14 | interface iJetpack_Sync_Replicastore { |
| 15 | // remove all data |
| 16 | public function reset(); |
| 17 | |
| 18 | // trigger setup for sync start/end |
| 19 | public function full_sync_start( $config ); |
| 20 | |
| 21 | public function full_sync_end( $checksum ); |
| 22 | |
| 23 | // posts |
| 24 | public function post_count( $status = null, $min_id = null, $max_id = null ); |
| 25 | |
| 26 | public function get_posts( $status = null, $min_id = null, $max_id = null ); |
| 27 | |
| 28 | public function get_post( $id ); |
| 29 | |
| 30 | public function upsert_post( $post, $silent = false ); |
| 31 | |
| 32 | public function delete_post( $post_id ); |
| 33 | |
| 34 | public function posts_checksum( $min_id = null, $max_id = null ); |
| 35 | public function post_meta_checksum( $min_id = null, $max_id = null ); |
| 36 | |
| 37 | // comments |
| 38 | public function comment_count( $status = null, $min_id = null, $max_id = null ); |
| 39 | |
| 40 | public function get_comments( $status = null, $min_id = null, $max_id = null ); |
| 41 | |
| 42 | public function get_comment( $id ); |
| 43 | |
| 44 | public function upsert_comment( $comment ); |
| 45 | |
| 46 | public function trash_comment( $comment_id ); |
| 47 | |
| 48 | public function spam_comment( $comment_id ); |
| 49 | |
| 50 | public function delete_comment( $comment_id ); |
| 51 | |
| 52 | public function trashed_post_comments( $post_id, $statuses ); |
| 53 | |
| 54 | public function untrashed_post_comments( $post_id ); |
| 55 | |
| 56 | public function comments_checksum( $min_id = null, $max_id = null ); |
| 57 | public function comment_meta_checksum( $min_id = null, $max_id = null ); |
| 58 | |
| 59 | // options |
| 60 | public function update_option( $option, $value ); |
| 61 | |
| 62 | public function get_option( $option, $default = false ); |
| 63 | |
| 64 | public function delete_option( $option ); |
| 65 | |
| 66 | // themes |
| 67 | public function set_theme_support( $theme_support ); |
| 68 | |
| 69 | public function current_theme_supports( $feature ); |
| 70 | |
| 71 | // meta |
| 72 | public function get_metadata( $type, $object_id, $meta_key = '', $single = false ); |
| 73 | |
| 74 | public function upsert_metadata( $type, $object_id, $meta_key, $meta_value, $meta_id ); |
| 75 | |
| 76 | public function delete_metadata( $type, $object_id, $meta_ids ); |
| 77 | |
| 78 | public function delete_batch_metadata( $type, $object_ids, $meta_key ); |
| 79 | |
| 80 | // constants |
| 81 | public function get_constant( $constant ); |
| 82 | |
| 83 | public function set_constant( $constant, $value ); |
| 84 | |
| 85 | // updates |
| 86 | public function get_updates( $type ); |
| 87 | |
| 88 | public function set_updates( $type, $updates ); |
| 89 | |
| 90 | // functions |
| 91 | public function get_callable( $callable ); |
| 92 | |
| 93 | public function set_callable( $callable, $value ); |
| 94 | |
| 95 | // network options |
| 96 | public function get_site_option( $option ); |
| 97 | |
| 98 | public function update_site_option( $option, $value ); |
| 99 | |
| 100 | public function delete_site_option( $option ); |
| 101 | |
| 102 | // terms |
| 103 | public function get_terms( $taxonomy ); |
| 104 | |
| 105 | public function get_term( $taxonomy, $term_id, $is_term_id = true ); |
| 106 | |
| 107 | public function update_term( $term_object ); |
| 108 | |
| 109 | public function delete_term( $term_id, $taxonomy ); |
| 110 | |
| 111 | public function get_the_terms( $object_id, $taxonomy ); |
| 112 | |
| 113 | public function update_object_terms( $object_id, $taxonomy, $terms, $append ); |
| 114 | |
| 115 | public function delete_object_terms( $object_id, $tt_ids ); |
| 116 | |
| 117 | // users |
| 118 | public function user_count(); |
| 119 | |
| 120 | public function get_user( $user_id ); |
| 121 | |
| 122 | public function upsert_user( $user ); |
| 123 | |
| 124 | public function delete_user( $user_id ); |
| 125 | |
| 126 | public function upsert_user_locale( $user_id, $locale ); |
| 127 | |
| 128 | public function delete_user_locale( $user_id ); |
| 129 | |
| 130 | public function get_user_locale( $user_id ); |
| 131 | |
| 132 | public function get_allowed_mime_types( $user_id ); |
| 133 | |
| 134 | |
| 135 | // full checksum |
| 136 | public function checksum_all(); |
| 137 | |
| 138 | // histogram |
| 139 | public function checksum_histogram( $object_type, $buckets, $start_id = null, $end_id = null ); |
| 140 | } |
| 141 |