diff options
author | Ben Pfaff <blp@nicira.com> | 2009-11-13 13:37:55 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2009-11-16 10:55:29 -0800 |
commit | bd06962ad334fa4631b67905fc9f43f96a908915 (patch) | |
tree | 0c8f3972670a022365fa443e416d8acb5036557f /ovsdb/ovsdb.h | |
parent | 41709cccb8099972f9c6c3faf583b1286cb92e8a (diff) | |
download | openvswitch-bd06962ad334fa4631b67905fc9f43f96a908915.tar.gz |
ovsdb: Add replication support and refactor files in terms of replication.
An upcoming commit will add support for replicating tables across JSON-RPC
connection. As a prerequisite ovsdb itself must support basic replication.
This commit adds that support and then reimplements the ovsdb file storage
in terms of that replication.
Diffstat (limited to 'ovsdb/ovsdb.h')
-rw-r--r-- | ovsdb/ovsdb.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ovsdb/ovsdb.h b/ovsdb/ovsdb.h index d57ebfca6..24ebd9c67 100644 --- a/ovsdb/ovsdb.h +++ b/ovsdb/ovsdb.h @@ -22,6 +22,8 @@ #include "shash.h" struct json; +struct ovsdb_log; +struct ovsdb_txn; struct uuid; /* Database schema. */ @@ -46,7 +48,7 @@ struct json *ovsdb_schema_to_json(const struct ovsdb_schema *); /* Database. */ struct ovsdb { struct ovsdb_schema *schema; - struct ovsdb_log *log; /* Disk log (null for in-memory db). */ + struct list replicas; /* Contains "struct ovsdb_replica"s. */ struct shash tables; /* Contains "struct ovsdb_table *"s. */ /* Triggers. */ @@ -54,10 +56,7 @@ struct ovsdb { bool run_triggers; }; -struct ovsdb *ovsdb_create(struct ovsdb_log *, struct ovsdb_schema *); -struct ovsdb_error *ovsdb_open(const char *file_name, bool read_only, - struct ovsdb **) - WARN_UNUSED_RESULT; +struct ovsdb *ovsdb_create(struct ovsdb_schema *); void ovsdb_destroy(struct ovsdb *); struct ovsdb_error *ovsdb_from_json(const struct json *, struct ovsdb **) @@ -69,5 +68,24 @@ struct ovsdb_table *ovsdb_get_table(const struct ovsdb *, const char *); struct json *ovsdb_execute(struct ovsdb *, const struct json *params, long long int elapsed_msec, long long int *timeout_msec); + +/* Database replication. */ + +struct ovsdb_replica { + struct list node; /* Element in "struct ovsdb" replicas list. */ + const struct ovsdb_replica_class *class; +}; + +struct ovsdb_replica_class { + struct ovsdb_error *(*commit)(struct ovsdb_replica *, + const struct ovsdb_txn *, bool durable); + void (*destroy)(struct ovsdb_replica *); +}; + +void ovsdb_replica_init(struct ovsdb_replica *, + const struct ovsdb_replica_class *); + +void ovsdb_add_replica(struct ovsdb *, struct ovsdb_replica *); +void ovsdb_remove_replica(struct ovsdb *, struct ovsdb_replica *); #endif /* ovsdb/ovsdb.h */ |