]>
Commit | Line | Data |
---|---|---|
2fa1df7b | 1 | /* |
009bf21f | 2 | * Copyright (c) 2015, 2017 Nicira, Inc. |
2fa1df7b AZ |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at: | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | #ifndef OVSDB_MONITOR_H | |
18 | #define OVSDB_MONITOR_H | |
19 | ||
009bf21f BP |
20 | struct ovsdb; |
21 | struct ovsdb_column; | |
2fa1df7b | 22 | struct ovsdb_monitor; |
85226894 | 23 | struct ovsdb_jsonrpc_monitor; |
71cdf7cd LS |
24 | struct ovsdb_monitor_session_condition; |
25 | struct ovsdb_condition; | |
009bf21f BP |
26 | struct ovsdb_txn; |
27 | struct simap; | |
2fa1df7b AZ |
28 | |
29 | enum ovsdb_monitor_selection { | |
71cdf7cd | 30 | OJMS_NONE = 0, /* None for this iteration */ |
2fa1df7b AZ |
31 | OJMS_INITIAL = 1 << 0, /* All rows when monitor is created. */ |
32 | OJMS_INSERT = 1 << 1, /* New rows. */ | |
33 | OJMS_DELETE = 1 << 2, /* Deleted rows. */ | |
34 | OJMS_MODIFY = 1 << 3 /* Modified rows. */ | |
35 | }; | |
36 | ||
37 | ||
52553aea AZ |
38 | enum ovsdb_monitor_version { |
39 | OVSDB_MONITOR_V1, /* RFC 7047 "monitor" method. */ | |
40 | OVSDB_MONITOR_V2, /* Extension to RFC 7047, see ovsdb-server | |
41 | man page for details. */ | |
9167cb52 HZ |
42 | OVSDB_MONITOR_V3, /* Extension to V2, see ovsdb-server man |
43 | page for details. */ | |
52553aea AZ |
44 | |
45 | /* Last entry. */ | |
46 | OVSDB_MONITOR_VERSION_MAX | |
47 | }; | |
48 | ||
be084595 HZ |
49 | struct ovsdb_monitor *ovsdb_monitor_create(struct ovsdb *, |
50 | struct ovsdb_jsonrpc_monitor *); | |
009bf21f BP |
51 | void ovsdb_monitors_remove(struct ovsdb *); |
52 | void ovsdb_monitors_commit(struct ovsdb *, const struct ovsdb_txn *); | |
6e5a9216 | 53 | |
53178986 BP |
54 | void ovsdb_monitor_prereplace_db(struct ovsdb *); |
55 | ||
be084595 | 56 | struct ovsdb_monitor *ovsdb_monitor_add(struct ovsdb_monitor *); |
6e5a9216 | 57 | |
be084595 HZ |
58 | void ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor *, |
59 | struct ovsdb_jsonrpc_monitor *); | |
6e5a9216 | 60 | |
222bed54 | 61 | struct ovsdb_monitor_change_set; |
be084595 HZ |
62 | void ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *, |
63 | struct ovsdb_jsonrpc_monitor *, | |
222bed54 | 64 | struct ovsdb_monitor_change_set *); |
d9412837 | 65 | |
be084595 HZ |
66 | void ovsdb_monitor_add_table(struct ovsdb_monitor *, |
67 | const struct ovsdb_table *); | |
2fa1df7b | 68 | |
be084595 HZ |
69 | const char * ovsdb_monitor_add_column(struct ovsdb_monitor *, |
70 | const struct ovsdb_table *, | |
71 | const struct ovsdb_column *, | |
72 | enum ovsdb_monitor_selection, | |
845a1187 LS |
73 | bool monitored); |
74 | bool | |
be084595 HZ |
75 | ovsdb_monitor_table_exists(struct ovsdb_monitor *, |
76 | const struct ovsdb_table *); | |
845a1187 | 77 | |
be084595 | 78 | struct json *ovsdb_monitor_get_update(struct ovsdb_monitor *, |
845a1187 LS |
79 | bool initial, |
80 | bool cond_updated, | |
be084595 HZ |
81 | struct ovsdb_monitor_session_condition *, |
82 | enum ovsdb_monitor_version, | |
222bed54 | 83 | struct ovsdb_monitor_change_set **p_mcs); |
2fa1df7b | 84 | |
9167cb52 HZ |
85 | const struct uuid *ovsdb_monitor_get_last_txnid(struct ovsdb_monitor *); |
86 | ||
be084595 HZ |
87 | void ovsdb_monitor_table_add_select(struct ovsdb_monitor *, |
88 | const struct ovsdb_table *, | |
89 | enum ovsdb_monitor_selection); | |
2fa1df7b | 90 | |
be084595 | 91 | bool ovsdb_monitor_needs_flush(struct ovsdb_monitor *, |
222bed54 | 92 | struct ovsdb_monitor_change_set *); |
2fa1df7b | 93 | |
222bed54 HZ |
94 | void ovsdb_monitor_get_initial(struct ovsdb_monitor *, |
95 | struct ovsdb_monitor_change_set **); | |
9167cb52 HZ |
96 | void ovsdb_monitor_get_changes_after(const struct uuid *txn_uuid, |
97 | struct ovsdb_monitor *, struct ovsdb_monitor_change_set **); | |
e0c73ed1 | 98 | |
be084595 | 99 | void ovsdb_monitor_get_memory_usage(struct simap *); |
71cdf7cd LS |
100 | |
101 | struct ovsdb_monitor_session_condition * | |
102 | ovsdb_monitor_session_condition_create(void); | |
103 | ||
104 | void | |
105 | ovsdb_monitor_session_condition_destroy( | |
be084595 | 106 | struct ovsdb_monitor_session_condition *); |
71cdf7cd LS |
107 | struct ovsdb_error * |
108 | ovsdb_monitor_table_condition_create( | |
be084595 HZ |
109 | struct ovsdb_monitor_session_condition *, |
110 | const struct ovsdb_table *, | |
71cdf7cd LS |
111 | const struct json *json_cnd); |
112 | ||
113 | void | |
be084595 HZ |
114 | ovsdb_monitor_condition_bind(struct ovsdb_monitor *, |
115 | struct ovsdb_monitor_session_condition *); | |
71cdf7cd | 116 | |
845a1187 LS |
117 | struct ovsdb_error * |
118 | ovsdb_monitor_table_condition_update( | |
be084595 HZ |
119 | struct ovsdb_monitor *, |
120 | struct ovsdb_monitor_session_condition *, | |
121 | const struct ovsdb_table *, | |
845a1187 LS |
122 | const struct json *cond_json); |
123 | ||
2fa1df7b | 124 | #endif |