PluginProbe
Gutenberg / 23.3.2
Gutenberg v23.3.2
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / compat / wordpress-7.1 / interface-wp-sync-storage.php

interface-wp-sync-storage.php in Gutenberg 23.3.2, at lib/compat/wordpress-7.1/interface-wp-sync-storage.php

90 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WP_Sync_Storage interface
4 *
5 * @package gutenberg
6 */
7
8 if ( ! interface_exists( 'WP_Sync_Storage' ) ) {
9
10 interface WP_Sync_Storage {
11 /**
12 * Adds a sync update to a given room.
13 *
14 * @since 7.0.0
15 *
16 * @param string $room Room identifier.
17 * @param mixed $update Serializable sync update, opaque to the storage implementation.
18 * @return bool True on success, false on failure.
19 */
20 public function add_update( string $room, $update ): bool;
21
22 /**
23 * Gets awareness state for a given room.
24 *
25 * @since 7.0.0
26 *
27 * @param string $room Room identifier.
28 * @return array<int, mixed> Awareness state.
29 */
30 public function get_awareness_state( string $room ): array;
31
32 /**
33 * Gets the current cursor for a given room. This should return a monotonically
34 * increasing integer that represents the last update that was returned for the
35 * room during the current request. This allows clients to retrieve updates
36 * after a specific cursor on subsequent requests.
37 *
38 * @since 7.0.0
39 *
40 * @param string $room Room identifier.
41 * @return int Current cursor for the room.
42 */
43 public function get_cursor( string $room ): int;
44
45 /**
46 * Gets the total number of stored updates for a given room.
47 *
48 * @since 7.0.0
49 *
50 * @param string $room Room identifier.
51 * @return int Total number of updates.
52 */
53 public function get_update_count( string $room ): int;
54
55 /**
56 * Retrieves sync updates from a room for a given client and cursor. Updates
57 * from the specified client should be excluded.
58 *
59 * @since 7.0.0
60 *
61 * @param string $room Room identifier.
62 * @param int $cursor Return updates after this cursor.
63 * @return array<int, mixed> Sync updates.
64 */
65 public function get_updates_after_cursor( string $room, int $cursor ): array;
66
67 /**
68 * Removes updates from a room that are older than the provided cursor.
69 *
70 * @since 7.0.0
71 *
72 * @param string $room Room identifier.
73 * @param int $cursor Remove updates with markers < this cursor.
74 * @return bool True on success, false on failure.
75 */
76 public function remove_updates_before_cursor( string $room, int $cursor ): bool;
77
78 /**
79 * Sets awareness state for a given room.
80 *
81 * @since 7.0.0
82 *
83 * @param string $room Room identifier.
84 * @param array<int, mixed> $awareness Serializable awareness state.
85 * @return bool True on success, false on failure.
86 */
87 public function set_awareness_state( string $room, array $awareness ): bool;
88 }
89 }
90