]>
Commit | Line | Data |
---|---|---|
1b1d2e6d BP |
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 uuid; | |
27 | ||
28 | struct ovsdb_error *ovsdb_storage_open(const char *filename, bool rw, | |
29 | struct ovsdb_storage **) | |
30 | OVS_WARN_UNUSED_RESULT; | |
31 | struct ovsdb_storage *ovsdb_storage_create_unbacked(void); | |
32 | void ovsdb_storage_close(struct ovsdb_storage *); | |
33 | ||
34 | const char *ovsdb_storage_get_model(const struct ovsdb_storage *); | |
35 | bool ovsdb_storage_is_clustered(const struct ovsdb_storage *); | |
36 | bool ovsdb_storage_is_connected(const struct ovsdb_storage *); | |
37 | bool ovsdb_storage_is_dead(const struct ovsdb_storage *); | |
38 | bool ovsdb_storage_is_leader(const struct ovsdb_storage *); | |
39 | const struct uuid *ovsdb_storage_get_cid(const struct ovsdb_storage *); | |
40 | const struct uuid *ovsdb_storage_get_sid(const struct ovsdb_storage *); | |
41 | uint64_t ovsdb_storage_get_applied_index(const struct ovsdb_storage *); | |
42 | ||
43 | void ovsdb_storage_run(struct ovsdb_storage *); | |
44 | void ovsdb_storage_wait(struct ovsdb_storage *); | |
45 | ||
46 | const char *ovsdb_storage_get_name(const struct ovsdb_storage *); | |
47 | ||
48 | struct ovsdb_error *ovsdb_storage_read(struct ovsdb_storage *, | |
49 | struct ovsdb_schema **schemap, | |
50 | struct json **txnp, | |
51 | struct uuid *txnid) | |
52 | OVS_WARN_UNUSED_RESULT; | |
53 | bool ovsdb_storage_read_wait(struct ovsdb_storage *); | |
54 | ||
55 | void ovsdb_storage_unread(struct ovsdb_storage *); | |
56 | ||
57 | struct ovsdb_write *ovsdb_storage_write(struct ovsdb_storage *, | |
58 | const struct json *, | |
59 | const struct uuid *prereq, | |
60 | struct uuid *result, | |
61 | bool durable) | |
62 | OVS_WARN_UNUSED_RESULT; | |
63 | struct ovsdb_error *ovsdb_storage_write_block(struct ovsdb_storage *, | |
64 | const struct json *, | |
65 | const struct uuid *prereq, | |
66 | struct uuid *result, | |
67 | bool durable); | |
68 | ||
69 | bool ovsdb_write_is_complete(const struct ovsdb_write *); | |
70 | const struct ovsdb_error *ovsdb_write_get_error(const struct ovsdb_write *); | |
71 | uint64_t ovsdb_write_get_commit_index(const struct ovsdb_write *); | |
72 | void ovsdb_write_wait(const struct ovsdb_write *); | |
73 | void ovsdb_write_destroy(struct ovsdb_write *); | |
74 | ||
75 | bool ovsdb_storage_should_snapshot(const struct ovsdb_storage *); | |
76 | struct ovsdb_error *ovsdb_storage_store_snapshot(struct ovsdb_storage *storage, | |
77 | const struct json *schema, | |
78 | const struct json *snapshot) | |
79 | OVS_WARN_UNUSED_RESULT; | |
80 | ||
81 | struct ovsdb_write *ovsdb_storage_write_schema_change( | |
82 | struct ovsdb_storage *, | |
83 | const struct json *schema, const struct json *data, | |
84 | const struct uuid *prereq, struct uuid *result) | |
85 | OVS_WARN_UNUSED_RESULT; | |
86 | ||
87 | /* Convenience functions for ovsdb-tool and other command-line utilities, | |
88 | * for use with standalone database files only, which terminate the process | |
89 | * on error. */ | |
90 | struct ovsdb_storage *ovsdb_storage_open_standalone(const char *filename, | |
91 | bool rw); | |
92 | struct ovsdb_schema *ovsdb_storage_read_schema(struct ovsdb_storage *); | |
93 | ||
94 | #endif /* ovsdb/storage.h */ |