Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raft: implement Raft consensus protocol #121

Draft
wants to merge 145 commits into
base: master
Choose a base branch
from
Draft

raft: implement Raft consensus protocol #121

wants to merge 145 commits into from

Conversation

SUMUKHA-PK
Copy link
Collaborator

@SUMUKHA-PK SUMUKHA-PK commented May 7, 2020

Will implement the raft protocol once complete based on the design doc in doc/internal/consensus

  • Code correctness
  • Documentation
  • Test cases

@tsatke tsatke self-requested a review May 7, 2020 14:24
@github-actions

This comment has been minimized.

@tsatke tsatke changed the title Implements Raft consensus protocol. Implement Raft consensus protocol May 8, 2020
@tsatke tsatke changed the title Implement Raft consensus protocol implement Raft consensus protocol May 8, 2020
@tsatke tsatke added feature New feature or enhancement component/raft Regarding the raft package and sub-packages labels May 8, 2020
@tsatke tsatke added this to the v0.0.1 milestone May 8, 2020
Repository owner deleted a comment from github-actions bot May 9, 2020
Repository owner deleted a comment from github-actions bot May 9, 2020
…es and moves simpleServer to SimpleServer while returning the same for raft.NewServer instead of an interface
…es and moves simpleServer to SimpleServer while returning the same for raft.NewServer instead of an interface
…es and moves simpleServer to SimpleServer while returning the same for raft.NewServer instead of an interface
…es and moves simpleServer to SimpleServer while returning the same for raft.NewServer instead of an interface
…mand to message and vice-versa + minor changes for staticcheck
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
// ConvertCommandToMessage converts a command.Command to a message.Command
func ConvertCommandToMessage(cmd command.Command) Message {
switch c := cmd.(type) {
case *command.Scan:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use pointers in the compiler? I don't think we use pointers to these structs ever. Use the actual values please. To ensure this works, add tests that use actual compiler output, to ensure this works and is usable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

*command.Scan implements command.Command and not command.Scan thus.

Ref: https://github.com/tomarrell/lbadd/blob/master/internal/compiler/command/command.go#L12

Copy link
Contributor

Choose a reason for hiding this comment

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

No, that's a compiler check
command.Scan implements command.Command
https://github.com/tomarrell/lbadd/blob/master/internal/compiler/command/command.go#L320

internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
}

// ConvertCommandToMessageRepeatedExprSlice converts a [][]command.Expr to a [][]message.Expr
func ConvertCommandToMessageRepeatedExprSlice(cmd [][]command.Expr) []*RepeatedExpr {
Copy link
Contributor

Choose a reason for hiding this comment

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

It takes a [][]command.Expr, which is not a command.Command

internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
}

// ConvertCommandToMessageLiteralExpr converts a command.Expr to a message.Expr_Literal.
func ConvertCommandToMessageLiteralExpr(cmd *command.LiteralExpr) *Expr_Literal {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use pointers in the compiler output

}

// ConvertCommandToMessageConstantBooleanExpr converts a command.Expr to a message.Expr_Constant.
func ConvertCommandToMessageConstantBooleanExpr(cmd *command.ConstantBooleanExpr) *Expr_Constant {
Copy link
Contributor

Choose a reason for hiding this comment

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

(This applies to all) Why does Expr_Constant need to be a pointer?

internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
internal/raft/message/convert.go Outdated Show resolved Hide resolved
Repository owner deleted a comment from github-actions bot Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/raft Regarding the raft package and sub-packages feature New feature or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

raft: implement protocol raft: integration tests
3 participants