]> git.proxmox.com Git - mirror_ovs.git/blob - ovsdb/storage.h
Eliminate "whitelist" and "blacklist" terms.
[mirror_ovs.git] / ovsdb / storage.h
1 /* Copyright (c) 2009, 2010, 2011, 2016, 2017 Nicira, Inc.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this storage except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifndef OVSDB_STORAGE_H
17 #define OVSDB_STORAGE_H 1
18
19 #include <stdint.h>
20 #include <sys/types.h>
21 #include "compiler.h"
22
23 struct json;
24 struct ovsdb_schema;
25 struct ovsdb_storage;
26 struct simap;
27 struct uuid;
28
29 struct ovsdb_error *ovsdb_storage_open(const char *filename, bool rw,
30 struct ovsdb_storage **)
31 OVS_WARN_UNUSED_RESULT;
32 struct ovsdb_storage *ovsdb_storage_create_unbacked(void);
33 void ovsdb_storage_close(struct ovsdb_storage *);
34
35 const char *ovsdb_storage_get_model(const struct ovsdb_storage *);
36 bool ovsdb_storage_is_clustered(const struct ovsdb_storage *);
37 bool ovsdb_storage_is_connected(const struct ovsdb_storage *);
38 bool ovsdb_storage_is_dead(const struct ovsdb_storage *);
39 bool ovsdb_storage_is_leader(const struct ovsdb_storage *);
40 const struct uuid *ovsdb_storage_get_cid(const struct ovsdb_storage *);
41 const struct uuid *ovsdb_storage_get_sid(const struct ovsdb_storage *);
42 uint64_t ovsdb_storage_get_applied_index(const struct ovsdb_storage *);
43 void ovsdb_storage_get_memory_usage(const struct ovsdb_storage *,
44 struct simap *usage);
45 char *ovsdb_storage_get_error(const struct ovsdb_storage *);
46
47 void ovsdb_storage_run(struct ovsdb_storage *);
48 void ovsdb_storage_wait(struct ovsdb_storage *);
49
50 const char *ovsdb_storage_get_name(const struct ovsdb_storage *);
51
52 struct ovsdb_error *ovsdb_storage_read(struct ovsdb_storage *,
53 struct ovsdb_schema **schemap,
54 struct json **txnp,
55 struct uuid *txnid)
56 OVS_WARN_UNUSED_RESULT;
57 bool ovsdb_storage_read_wait(struct ovsdb_storage *);
58
59 void ovsdb_storage_unread(struct ovsdb_storage *);
60
61 struct ovsdb_write *ovsdb_storage_write(struct ovsdb_storage *,
62 const struct json *,
63 const struct uuid *prereq,
64 struct uuid *result,
65 bool durable)
66 OVS_WARN_UNUSED_RESULT;
67 struct ovsdb_error *ovsdb_storage_write_block(struct ovsdb_storage *,
68 const struct json *,
69 const struct uuid *prereq,
70 struct uuid *result,
71 bool durable);
72
73 bool ovsdb_write_is_complete(const struct ovsdb_write *);
74 const struct ovsdb_error *ovsdb_write_get_error(const struct ovsdb_write *);
75 uint64_t ovsdb_write_get_commit_index(const struct ovsdb_write *);
76 void ovsdb_write_wait(const struct ovsdb_write *);
77 void ovsdb_write_destroy(struct ovsdb_write *);
78
79 bool ovsdb_storage_should_snapshot(const struct ovsdb_storage *);
80 struct ovsdb_error *ovsdb_storage_store_snapshot(struct ovsdb_storage *storage,
81 const struct json *schema,
82 const struct json *snapshot)
83 OVS_WARN_UNUSED_RESULT;
84
85 struct ovsdb_write *ovsdb_storage_write_schema_change(
86 struct ovsdb_storage *,
87 const struct json *schema, const struct json *data,
88 const struct uuid *prereq, struct uuid *result)
89 OVS_WARN_UNUSED_RESULT;
90
91 /* Convenience functions for ovsdb-tool and other command-line utilities,
92 * for use with standalone database files only, which terminate the process
93 * on error. */
94 struct ovsdb_storage *ovsdb_storage_open_standalone(const char *filename,
95 bool rw);
96 struct ovsdb_schema *ovsdb_storage_read_schema(struct ovsdb_storage *);
97
98 const struct uuid *ovsdb_storage_peek_last_eid(struct ovsdb_storage *);
99
100 #endif /* ovsdb/storage.h */