]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/ovsdb-idl-provider.h
1 /* Copyright (c) 2009, 2010 Nicira Networks.
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.
16 #ifndef OVSDB_IDL_PROVIDER_H
17 #define OVSDB_IDL_PROVIDER_H 1
21 #include "ovsdb-idl.h"
22 #include "ovsdb-types.h"
26 struct ovsdb_idl_row
{
27 struct hmap_node hmap_node
; /* In struct ovsdb_idl_table's 'rows'. */
28 struct uuid uuid
; /* Row "_uuid" field. */
29 struct list src_arcs
; /* Forward arcs (ovsdb_idl_arc.src_node). */
30 struct list dst_arcs
; /* Backward arcs (ovsdb_idl_arc.dst_node). */
31 struct ovsdb_idl_table
*table
; /* Containing table. */
32 struct ovsdb_datum
*old
; /* Committed data (null if orphaned). */
34 /* Transactional data. */
35 struct ovsdb_datum
*new; /* Modified data (null to delete row). */
36 unsigned long int *prereqs
; /* Bitmap of columns to verify in "old". */
37 unsigned long int *written
; /* Bitmap of columns from "new" to write. */
38 struct hmap_node txn_node
; /* Node in ovsdb_idl_txn's list. */
41 struct ovsdb_idl_column
{
43 struct ovsdb_type type
;
44 void (*parse
)(struct ovsdb_idl_row
*, const struct ovsdb_datum
*);
45 void (*unparse
)(struct ovsdb_idl_row
*);
48 struct ovsdb_idl_table_class
{
50 const struct ovsdb_idl_column
*columns
;
52 size_t allocation_size
;
56 /* Client reads and may write this column and wants to be alerted upon
59 * This is the default. */
62 /* Client may read and write this column, but doesn't care to be alerted
65 * This is useful for columns that a client treats as "write-only", that
66 * is, it updates them but doesn't want to get alerted about its own
67 * updates. It also won't be alerted about other clients' updates, so this
68 * is suitable only for use by a client that "owns" a particular column. */
71 /* Client won't read or write this column at all. The IDL code can't
72 * prevent reading the column, but writing will cause assertion
77 struct ovsdb_idl_table
{
78 const struct ovsdb_idl_table_class
*class;
79 unsigned char *modes
; /* One of OVSDB_MODE_*, indexed by column. */
80 struct shash columns
; /* Contains "const struct ovsdb_idl_column *"s. */
81 struct hmap rows
; /* Contains "struct ovsdb_idl_row"s. */
82 struct ovsdb_idl
*idl
; /* Containing idl. */
85 struct ovsdb_idl_class
{
86 const char *database
; /* <db-name> for this database. */
87 const struct ovsdb_idl_table_class
*tables
;
91 struct ovsdb_idl_row
*ovsdb_idl_get_row_arc(
92 struct ovsdb_idl_row
*src
,
93 struct ovsdb_idl_table_class
*dst_table
,
94 const struct uuid
*dst_uuid
);
96 void ovsdb_idl_txn_verify(const struct ovsdb_idl_row
*,
97 const struct ovsdb_idl_column
*);
99 struct ovsdb_idl_txn
*ovsdb_idl_txn_get(const struct ovsdb_idl_row
*);
101 #endif /* ovsdb-idl-provider.h */