Skip to content

Raft#2

Open
baselrabia wants to merge 2 commits into
mrgb7:mainfrom
baselrabia:raft
Open

Raft#2
baselrabia wants to merge 2 commits into
mrgb7:mainfrom
baselrabia:raft

Conversation

@baselrabia

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread server/fsm.go
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
Copy Markdown
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