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