Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions example/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ struct Fsm

static int FsmApply(struct raft_fsm *fsm,
const struct raft_buffer *buf,
raft_term term,
void **result)
{
(void)term;
struct Fsm *f = fsm->data;
if (buf->len != 8) {
return RAFT_MALFORMED;
Expand Down
1 change: 1 addition & 0 deletions include/raft.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,7 @@ struct raft_fsm
void *data;
int (*apply)(struct raft_fsm *fsm,
const struct raft_buffer *buf,
raft_term term,
void **result);
int (*snapshot)(struct raft_fsm *fsm,
struct raft_buffer *bufs[],
Expand Down
7 changes: 4 additions & 3 deletions src/legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,12 +883,13 @@ static struct request *legacyGetRequest(struct raft *r,
/* Apply a RAFT_COMMAND entry that has been committed. */
static int applyCommand(struct raft *r,
const raft_index index,
const struct raft_buffer *buf)
const struct raft_buffer *buf,
raft_term term)
{
struct raft_apply *req;
void *result;
int rv;
rv = r->fsm->apply(r->fsm, buf, &result);
rv = r->fsm->apply(r->fsm, buf, term, &result);
if (rv != 0) {
return rv;
}
Expand Down Expand Up @@ -968,7 +969,7 @@ static int legacyApply(struct raft *r,

switch (entry->type) {
case RAFT_COMMAND:
rv = applyCommand(r, index, &entry->buf);
rv = applyCommand(r, index, &entry->buf, entry->term);
break;
case RAFT_BARRIER:
applyBarrier(r, index);
Expand Down
2 changes: 2 additions & 0 deletions test/lib/fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ enum { SET_X = 1, SET_Y, ADD_X, ADD_Y };

static int fsmApply(struct raft_fsm *fsm,
const struct raft_buffer *buf,
raft_term term,
void **result)
{
(void)term;
struct fsm *f = fsm->data;
const uint8_t *cursor = buf->base;
unsigned command;
Expand Down
2 changes: 2 additions & 0 deletions tools/benchmark/submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@

static int fsmApply(struct raft_fsm *fsm,
const struct raft_buffer *buf,
raft_term term,
void **result)
{
(void)fsm;
(void)buf;
(void)term;
(void)result;
return 0;
}
Expand Down
Loading