]>
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>
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
*);
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
*,
45 char *ovsdb_storage_get_error(const struct ovsdb_storage
*);
47 void ovsdb_storage_run(struct ovsdb_storage
*);
48 void ovsdb_storage_wait(struct ovsdb_storage
*);
50 const char *ovsdb_storage_get_name(const struct ovsdb_storage
*);
52 struct ovsdb_error
*ovsdb_storage_read(struct ovsdb_storage
*,
53 struct ovsdb_schema
**schemap
,
56 OVS_WARN_UNUSED_RESULT
;
57 bool ovsdb_storage_read_wait(struct ovsdb_storage
*);
59 void ovsdb_storage_unread(struct ovsdb_storage
*);
61 struct ovsdb_write
*ovsdb_storage_write(struct ovsdb_storage
*,
63 const struct uuid
*prereq
,
66 OVS_WARN_UNUSED_RESULT
;
67 struct ovsdb_error
*ovsdb_storage_write_block(struct ovsdb_storage
*,
69 const struct uuid
*prereq
,
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
*);
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
;
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
;
91 /* Convenience functions for ovsdb-tool and other command-line utilities,
92 * for use with standalone database files only, which terminate the process
94 struct ovsdb_storage
*ovsdb_storage_open_standalone(const char *filename
,
96 struct ovsdb_schema
*ovsdb_storage_read_schema(struct ovsdb_storage
*);
98 const struct uuid
*ovsdb_storage_peek_last_eid(struct ovsdb_storage
*);
100 #endif /* ovsdb/storage.h */