Commit c7d4e751 authored by Yossi Gottlieb's avatar Yossi Gottlieb
Browse files

Add custom raft_entry free function.

parent 6430c51f
......@@ -89,7 +89,7 @@ typedef struct
} raft_entry_data_t;
/** Entry that is stored in the server's entry log. */
typedef struct
typedef struct raft_entry
{
/** the entry's term at the point it was created */
raft_term_t term;
......@@ -106,6 +106,9 @@ typedef struct
/** private local data */
void *user_data;
/** free function, used instead of __free if specified */
void (*free_func) (struct raft_entry *entry);
/** data length */
unsigned int data_len;
......
......@@ -1539,7 +1539,11 @@ void raft_entry_release(raft_entry_t *ety)
ety->refs--;
if (!ety->refs) {
__raft_free(ety);
if (ety->free_func) {
ety->free_func(ety);
} else {
__raft_free(ety);
}
}
}
......
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