summaryrefslogtreecommitdiff
blob: 706f230abbeef7853713c1042b0b45f724b4f721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
/**
 * Sync architecture prototype
 * @author Dan Walmsley
 * To run tests: phpunit --testsuite sync --filter New_Sync
 */

/**
 * A high-level interface for objects that store synced WordPress data
 * Useful for ensuring that different storage mechanisms implement the
 * required semantics for storing all the data that we sync
 */
interface iJetpack_Sync_Replicastore {
	// remove all data
	public function reset();

	// trigger setup for sync start/end
	public function full_sync_start( $config );

	public function full_sync_end( $checksum );

	// posts
	public function post_count( $status = null, $min_id = null, $max_id = null );

	public function get_posts( $status = null, $min_id = null, $max_id = null );

	public function get_post( $id );

	public function upsert_post( $post, $silent = false );

	public function delete_post( $post_id );

	public function posts_checksum( $min_id = null, $max_id = null );
	public function post_meta_checksum( $min_id = null, $max_id = null );

	// comments
	public function comment_count( $status = null, $min_id = null, $max_id = null );

	public function get_comments( $status = null, $min_id = null, $max_id = null );

	public function get_comment( $id );

	public function upsert_comment( $comment );

	public function trash_comment( $comment_id );

	public function spam_comment( $comment_id );

	public function delete_comment( $comment_id );

	public function trashed_post_comments( $post_id, $statuses );

	public function untrashed_post_comments( $post_id );

	public function comments_checksum( $min_id = null, $max_id = null );
	public function comment_meta_checksum( $min_id = null, $max_id = null );

	// options
	public function update_option( $option, $value );

	public function get_option( $option, $default = false );

	public function delete_option( $option );

	// themes
	public function set_theme_support( $theme_support );

	public function current_theme_supports( $feature );

	// meta
	public function get_metadata( $type, $object_id, $meta_key = '', $single = false );

	public function upsert_metadata( $type, $object_id, $meta_key, $meta_value, $meta_id );

	public function delete_metadata( $type, $object_id, $meta_ids );

	public function delete_batch_metadata( $type, $object_ids, $meta_key );

	// constants
	public function get_constant( $constant );

	public function set_constant( $constant, $value );

	// updates
	public function get_updates( $type );

	public function set_updates( $type, $updates );

	// functions
	public function get_callable( $callable );

	public function set_callable( $callable, $value );

	// network options
	public function get_site_option( $option );

	public function update_site_option( $option, $value );

	public function delete_site_option( $option );

	// terms
	public function get_terms( $taxonomy );

	public function get_term( $taxonomy, $term_id, $is_term_id = true );

	public function update_term( $term_object );

	public function delete_term( $term_id, $taxonomy );

	public function get_the_terms( $object_id, $taxonomy );

	public function update_object_terms( $object_id, $taxonomy, $terms, $append );

	public function delete_object_terms( $object_id, $tt_ids );

	// users
	public function user_count();

	public function get_user( $user_id );

	public function upsert_user( $user );

	public function delete_user( $user_id );

	public function upsert_user_locale( $user_id, $locale );

	public function delete_user_locale( $user_id );

	public function get_user_locale( $user_id );

	public function get_allowed_mime_types( $user_id );


	// full checksum
	public function checksum_all();

	// histogram
	public function checksum_histogram( $object_type, $buckets, $start_id = null, $end_id = null );
}