Skip to content

Conversation

@baselrabia
Copy link
Contributor

No description provided.

Comment on lines +14 to +30
// Apply applies a Raft log entry to the dummy FSM
func (s *Server) Apply(l *raft.Log) interface{} {

// Extract the command data from the log entry
reader := bytes.NewReader(l.Data)
// Deserialize the command
command, err := cmd.ParseSetCommand(reader)
if err != nil {
return err
}

if err := s.db.Set(command.Key, command.Val, time.Duration(command.Duration)); err != nil {
return err
}

return nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply on write

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant