]>
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. */ | |
42 | ||
43 | /* Last entry. */ | |
44 | OVSDB_MONITOR_VERSION_MAX | |
45 | }; | |
46 | ||
2fa1df7b | 47 | struct ovsdb_monitor *ovsdb_monitor_create(struct ovsdb *db, |
6e5a9216 | 48 | struct ovsdb_jsonrpc_monitor *jsonrpc_monitor); |
009bf21f BP |
49 | void ovsdb_monitors_remove(struct ovsdb *); |
50 | void ovsdb_monitors_commit(struct ovsdb *, const struct ovsdb_txn *); | |
6e5a9216 | 51 | |
53178986 BP |
52 | void ovsdb_monitor_prereplace_db(struct ovsdb *); |
53 | ||
6e5a9216 AZ |
54 | struct ovsdb_monitor *ovsdb_monitor_add(struct ovsdb_monitor *dbmon); |
55 | ||
56 | void ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor *dbmon, | |
57 | struct ovsdb_jsonrpc_monitor *jsonrpc_monitor); | |
58 | ||
59 | void ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *dbmon, | |
f76def25 AZ |
60 | struct ovsdb_jsonrpc_monitor *jsonrpc_monitor, |
61 | uint64_t unflushed); | |
d9412837 | 62 | |
2fa1df7b AZ |
63 | void ovsdb_monitor_add_table(struct ovsdb_monitor *m, |
64 | const struct ovsdb_table *table); | |
65 | ||
ec1eadce | 66 | const char * ovsdb_monitor_add_column(struct ovsdb_monitor *dbmon, |
845a1187 LS |
67 | const struct ovsdb_table *table, |
68 | const struct ovsdb_column *column, | |
69 | enum ovsdb_monitor_selection select, | |
70 | bool monitored); | |
71 | bool | |
72 | ovsdb_monitor_table_exists(struct ovsdb_monitor *m, | |
73 | const struct ovsdb_table *table); | |
74 | ||
75 | struct json *ovsdb_monitor_get_update(struct ovsdb_monitor *dbmon, | |
76 | bool initial, | |
77 | bool cond_updated, | |
78 | uint64_t *unflushed_transaction, | |
79 | struct ovsdb_monitor_session_condition *condition, | |
80 | enum ovsdb_monitor_version version); | |
2fa1df7b AZ |
81 | |
82 | void ovsdb_monitor_table_add_select(struct ovsdb_monitor *dbmon, | |
83 | const struct ovsdb_table *table, | |
84 | enum ovsdb_monitor_selection select); | |
85 | ||
59c35e11 AZ |
86 | bool ovsdb_monitor_needs_flush(struct ovsdb_monitor *dbmon, |
87 | uint64_t next_transaction); | |
2fa1df7b | 88 | |
61b63013 | 89 | void ovsdb_monitor_get_initial(const struct ovsdb_monitor *dbmon); |
e0c73ed1 AZ |
90 | |
91 | void ovsdb_monitor_get_memory_usage(struct simap *usage); | |
71cdf7cd LS |
92 | |
93 | struct ovsdb_monitor_session_condition * | |
94 | ovsdb_monitor_session_condition_create(void); | |
95 | ||
96 | void | |
97 | ovsdb_monitor_session_condition_destroy( | |
98 | struct ovsdb_monitor_session_condition *condition); | |
99 | struct ovsdb_error * | |
100 | ovsdb_monitor_table_condition_create( | |
101 | struct ovsdb_monitor_session_condition *condition, | |
102 | const struct ovsdb_table *table, | |
103 | const struct json *json_cnd); | |
104 | ||
105 | void | |
106 | ovsdb_monitor_condition_bind(struct ovsdb_monitor *dbmon, | |
107 | struct ovsdb_monitor_session_condition *cond); | |
108 | ||
845a1187 LS |
109 | struct ovsdb_error * |
110 | ovsdb_monitor_table_condition_update( | |
111 | struct ovsdb_monitor *dbmon, | |
112 | struct ovsdb_monitor_session_condition *condition, | |
113 | const struct ovsdb_table *table, | |
114 | const struct json *cond_json); | |
115 | ||
2fa1df7b | 116 | #endif |