-
Notifications
You must be signed in to change notification settings - Fork 26
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
…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
…mand to message and vice-versa + minor changes for staticcheck
internal/raft/message/convert.go
Outdated
// ConvertCommandToMessage converts a command.Command to a message.Command | ||
func ConvertCommandToMessage(cmd command.Command) Message { | ||
switch c := cmd.(type) { | ||
case *command.Scan: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
} | ||
|
||
// ConvertCommandToMessageRepeatedExprSlice converts a [][]command.Expr to a [][]message.Expr | ||
func ConvertCommandToMessageRepeatedExprSlice(cmd [][]command.Expr) []*RepeatedExpr { |
There was a problem hiding this comment.
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
} | ||
|
||
// ConvertCommandToMessageLiteralExpr converts a command.Expr to a message.Expr_Literal. | ||
func ConvertCommandToMessageLiteralExpr(cmd *command.LiteralExpr) *Expr_Literal { |
There was a problem hiding this comment.
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
internal/raft/message/convert.go
Outdated
} | ||
|
||
// ConvertCommandToMessageConstantBooleanExpr converts a command.Expr to a message.Expr_Constant. | ||
func ConvertCommandToMessageConstantBooleanExpr(cmd *command.ConstantBooleanExpr) *Expr_Constant { |
There was a problem hiding this comment.
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?
…es, moves from the sloppy timer based tests to a basic idea of hook based test for mock raft tests
…ng into message conversions
…and removes deprecated packages executor and compile
…and shutting down raft nodes on those nodes
Will implement the raft protocol once complete based on the design doc in
doc/internal/consensus