Unverified Commit 7371bc92 authored by Yehoshua (Josh) Hershberg's avatar Yehoshua (Josh) Hershberg Committed by GitHub
Browse files

Document entry ownership on log callbacks (#124)

parent e5d1ceb1
...@@ -836,6 +836,8 @@ typedef struct raft_log_impl ...@@ -836,6 +836,8 @@ typedef struct raft_log_impl
/** Remove entries from the start of the log, as necessary when compacting /** Remove entries from the start of the log, as necessary when compacting
* the log and deleting the oldest entries. * the log and deleting the oldest entries.
* *
* The log implementation must call raft_entry_release() on any removed in-memory entries
*
* @param[in] first_idx Index of first entry to be left in log. * @param[in] first_idx Index of first entry to be left in log.
* @return * @return
* 0 on success; * 0 on success;
...@@ -846,6 +848,8 @@ typedef struct raft_log_impl ...@@ -846,6 +848,8 @@ typedef struct raft_log_impl
/** Remove entries from the end of the log, as necessary when rolling back /** Remove entries from the end of the log, as necessary when rolling back
* append operations that have not been committed. * append operations that have not been committed.
* *
* The log implementation must call raft_entry_release() on any removed in-memory entries
*
* @param[in] from_idx Index of first entry to be removed. All entries * @param[in] from_idx Index of first entry to be removed. All entries
* starting from and including this index shall be removed. * starting from and including this index shall be removed.
* @param[in] cb Optional callback to execute for every removed entry. * @param[in] cb Optional callback to execute for every removed entry.
...@@ -857,6 +861,8 @@ typedef struct raft_log_impl ...@@ -857,6 +861,8 @@ typedef struct raft_log_impl
int (*pop) (void *log, raft_index_t from_idx, raft_entry_notify_f cb, void *cb_arg); int (*pop) (void *log, raft_index_t from_idx, raft_entry_notify_f cb, void *cb_arg);
/** Get a single entry from the log. /** Get a single entry from the log.
*
* The log implementation must call raft_entry_hold() on the fetched entry
* *
* @param[in] idx Index of entry to fetch. * @param[in] idx Index of entry to fetch.
* @return * @return
...@@ -870,6 +876,8 @@ typedef struct raft_log_impl ...@@ -870,6 +876,8 @@ typedef struct raft_log_impl
raft_entry_t* (*get) (void *log, raft_index_t idx); raft_entry_t* (*get) (void *log, raft_index_t idx);
/** Get a batch of entries from the log. /** Get a batch of entries from the log.
*
* The log implementation must call raft_entry_hold() on the fetched entries
* *
* @param[in] idx Index of first entry to fetch. * @param[in] idx Index of first entry to fetch.
* @param[in] entries_n Length of entries (max. entries to fetch). * @param[in] entries_n Length of entries (max. entries to fetch).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment