diff options
author | Ben Pfaff <blp@ovn.org> | 2017-12-24 17:52:34 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-12-24 18:12:32 -0800 |
commit | 4cc9d1f03f83e9fac90a77ddaca0af662b2758b1 (patch) | |
tree | 2e15bc324b4118fa68e9c3939975156ea28ed89a /ovsdb/log.h | |
parent | d0c43b59eac9eb3fbcd5aaac32bfca99ce0ee5c8 (diff) | |
download | openvswitch-4cc9d1f03f83e9fac90a77ddaca0af662b2758b1.tar.gz |
log: Replace ovsdb_log_get_offset() by a more abstract mechanism.
Upcoming support for clustered databases will need to provide a more
abstract way to determine when a given file should be compacted, so this
changes the standalone database support to use this mechanism in advance.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'ovsdb/log.h')
-rw-r--r-- | ovsdb/log.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ovsdb/log.h b/ovsdb/log.h index 6bb2aaa21..18900fa50 100644 --- a/ovsdb/log.h +++ b/ovsdb/log.h @@ -16,6 +16,25 @@ #ifndef OVSDB_LOG_H #define OVSDB_LOG_H 1 +/* OVSDB log. + * + * A log consists of a series of records. After opening or creating a log with + * ovsdb_log_open(), the client may use ovsdb_log_read() to read any existing + * records, one by one. The client may also use ovsdb_log_write() to write new + * records (if some records have not yet been read at this point, then the + * first write truncates them). + * + * Log writes are atomic. A client may use ovsdb_log_commit() to ensure that + * they are durable. + * + * Logs provide a mechansim to allow the client to tell when they have grown + * enough that compacting may be warranted. After reading existing log + * contents, the client uses ovsdb_log_mark_base() to mark the "base" to be + * considered as the initial size of the log. Thereafter, a client may call + * ovsdb_log_grew_lots() to get an indication whether the log has grown enough + * that compacting is advised. + */ + #include <sys/types.h> #include "compiler.h" @@ -54,7 +73,8 @@ struct ovsdb_error *ovsdb_log_write(struct ovsdb_log *, const struct json *) struct ovsdb_error *ovsdb_log_commit(struct ovsdb_log *) OVS_WARN_UNUSED_RESULT; -off_t ovsdb_log_get_offset(const struct ovsdb_log *); +void ovsdb_log_mark_base(struct ovsdb_log *); +bool ovsdb_log_grew_lots(const struct ovsdb_log *); struct ovsdb_error *ovsdb_log_replace(struct ovsdb_log *, struct json **entries, size_t n) |