]>
git.proxmox.com Git - mirror_ovs.git/blob - ovsdb/storage.h
1 /* Copyright (c) 2009, 2010, 2011, 2016, 2017 Nicira, Inc.
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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef OVSDB_STORAGE_H
17 #define OVSDB_STORAGE_H 1
20 #include <sys/types.h>
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
*);
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
*);
43 void ovsdb_storage_run(struct ovsdb_storage
*);
44 void ovsdb_storage_wait(struct ovsdb_storage
*);
46 const char *ovsdb_storage_get_name(const struct ovsdb_storage
*);
48 struct ovsdb_error
*ovsdb_storage_read(struct ovsdb_storage
*,
49 struct ovsdb_schema
**schemap
,
52 OVS_WARN_UNUSED_RESULT
;
53 bool ovsdb_storage_read_wait(struct ovsdb_storage
*);
55 void ovsdb_storage_unread(struct ovsdb_storage
*);
57 struct ovsdb_write
*ovsdb_storage_write(struct ovsdb_storage
*,
59 const struct uuid
*prereq
,
62 OVS_WARN_UNUSED_RESULT
;
63 struct ovsdb_error
*ovsdb_storage_write_block(struct ovsdb_storage
*,
65 const struct uuid
*prereq
,
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
*);
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
;
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
;
87 /* Convenience functions for ovsdb-tool and other command-line utilities,
88 * for use with standalone database files only, which terminate the process
90 struct ovsdb_storage
*ovsdb_storage_open_standalone(const char *filename
,
92 struct ovsdb_schema
*ovsdb_storage_read_schema(struct ovsdb_storage
*);
94 const struct uuid
*ovsdb_storage_peek_last_eid(struct ovsdb_storage
*);
96 #endif /* ovsdb/storage.h */