From 421fc8a1359e50049c1509bc920e64e6591dc925 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 7 Dec 2017 14:33:28 -0800 Subject: log: New functions for replacing a log's contents. These functions will acquire users in future commits. This new functionality made the internal state machine of the log hard enough to understand that I thought that it was best to make it explicit with a 'state' variable, so this commit introduces one. This commit duplicates code and logic from ovsdb_rename() and ovsdb_compact() in ovsdb/file.c. A future commit removes this duplication. Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- ovsdb/log.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ovsdb/log.h') diff --git a/ovsdb/log.h b/ovsdb/log.h index a6cba58e1..cc8469c01 100644 --- a/ovsdb/log.h +++ b/ovsdb/log.h @@ -53,4 +53,18 @@ struct ovsdb_error *ovsdb_log_commit(struct ovsdb_log *) off_t ovsdb_log_get_offset(const struct ovsdb_log *); +struct ovsdb_error *ovsdb_log_replace(struct ovsdb_log *, + struct json **entries, size_t n) + OVS_WARN_UNUSED_RESULT; +struct ovsdb_error *ovsdb_log_replace_start(struct ovsdb_log *old, + struct ovsdb_log **newp) + OVS_WARN_UNUSED_RESULT; +struct ovsdb_error *ovsdb_log_replace_commit(struct ovsdb_log *old, + struct ovsdb_log *new) + OVS_WARN_UNUSED_RESULT; +void ovsdb_log_replace_abort(struct ovsdb_log *new); + +/* For testing. */ +void ovsdb_log_disable_renaming_open_files(void); + #endif /* ovsdb/log.h */ -- cgit v1.2.1