]>
git.proxmox.com Git - mirror_ovs.git/blob - ovsdb/ovsdb.h
1 /* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2017 Nicira, Inc.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file 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.
17 #define OVSDB_OVSDB_H 1
20 #include "openvswitch/hmap.h"
21 #include "openvswitch/list.h"
22 #include "openvswitch/shash.h"
23 #include "openvswitch/uuid.h"
31 /* Database schema. */
36 struct shash tables
; /* Contains "struct ovsdb_table_schema *"s. */
39 struct ovsdb_schema
*ovsdb_schema_create(const char *name
,
42 struct ovsdb_schema
*ovsdb_schema_clone(const struct ovsdb_schema
*);
43 void ovsdb_schema_destroy(struct ovsdb_schema
*);
45 struct ovsdb_error
*ovsdb_schema_from_file(const char *file_name
,
46 struct ovsdb_schema
**)
47 OVS_WARN_UNUSED_RESULT
;
48 struct ovsdb_error
*ovsdb_schema_from_json(const struct json
*,
49 struct ovsdb_schema
**)
50 OVS_WARN_UNUSED_RESULT
;
51 struct json
*ovsdb_schema_to_json(const struct ovsdb_schema
*);
53 bool ovsdb_schema_equal(const struct ovsdb_schema
*,
54 const struct ovsdb_schema
*);
56 struct ovsdb_error
*ovsdb_schema_check_for_ephemeral_columns(
57 const struct ovsdb_schema
*) OVS_WARN_UNUSED_RESULT
;
58 void ovsdb_schema_persist_ephemeral_columns(struct ovsdb_schema
*,
59 const char *filename
);
61 struct ovsdb_version
{
66 bool ovsdb_parse_version(const char *, struct ovsdb_version
*);
67 bool ovsdb_is_valid_version(const char *);
72 struct ovsdb_schema
*schema
;
73 struct ovsdb_storage
*storage
; /* If nonnull, log for transactions. */
75 struct ovs_list monitors
; /* Contains "struct ovsdb_monitor"s. */
76 struct shash tables
; /* Contains "struct ovsdb_table *"s. */
79 struct ovs_list triggers
; /* Contains "struct ovsdb_trigger"s. */
82 struct ovsdb_table
*rbac_role
;
85 struct ovsdb
*ovsdb_create(struct ovsdb_schema
*, struct ovsdb_storage
*);
86 void ovsdb_destroy(struct ovsdb
*);
88 void ovsdb_get_memory_usage(const struct ovsdb
*, struct simap
*usage
);
90 struct ovsdb_table
*ovsdb_get_table(const struct ovsdb
*, const char *);
92 struct ovsdb_txn
*ovsdb_execute_compose(
93 struct ovsdb
*, const struct ovsdb_session
*, const struct json
*params
,
94 bool read_only
, const char *role
, const char *id
,
95 long long int elapsed_msec
, long long int *timeout_msec
,
96 bool *durable
, struct json
**);
98 struct json
*ovsdb_execute(struct ovsdb
*, const struct ovsdb_session
*,
99 const struct json
*params
, bool read_only
,
100 const char *role
, const char *id
,
101 long long int elapsed_msec
,
102 long long int *timeout_msec
);
104 struct ovsdb_error
*ovsdb_snapshot(struct ovsdb
*) OVS_WARN_UNUSED_RESULT
;
106 void ovsdb_replace(struct ovsdb
*dst
, struct ovsdb
*src
);
108 #endif /* ovsdb/ovsdb.h */