-
Notifications
You must be signed in to change notification settings - Fork 0
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
[WIP] Visualisation Backend #406
base: master
Are you sure you want to change the base?
Conversation
This document defined the API used for exporting data from Raft | ||
|
||
## Enabling Exporting ## | ||
By default the exporting function is off, to turn it on `pfsd` must be ran with |
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.
Typo: "must be run"
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.
I always make that mistake :) thanks
e256465
to
47e910e
Compare
…on of sending and receiving data
Uuid: nodes[i].NodeID, | ||
CommonName: nodes[i].CommonName, | ||
State: "unknown", | ||
Addr: nodes[i].IP+nodes[i].Port, |
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.
Just noticed I am missing :
here. Will add in next commit
if(*exportFlag){ | ||
raft.EnableExporting = true | ||
exporter.NewStdServer(*exportPortFlag); | ||
go exporter.Listen(); |
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 should be added to a wait group.
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.
Done
@@ -285,6 +309,96 @@ func (s *RaftNetworkServer) sendLeaderLogEntry(entry *pb.Entry) error { | |||
} | |||
} | |||
|
|||
func (s *RaftNetworkServer) sendLeaderDataRequest() { | |||
// TODO: Proper Implementation with channels | |||
s.Wait.Done() |
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 should be defered
…file in raft containing all the exporting functions
for i := 0; i < len(nodes); i++ { | ||
detailedNodes = append(detailedNodes, &pb.LeaderData_Data_DetailedNode{ | ||
Uuid: nodes[i].NodeID, | ||
CommonName: nodes[i].CommonName, |
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.
Is this go fmted?
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.
sigh
I blame bad habits that go-plus
created by formatting for me....
client := pb.NewRaftNetworkClient(conn) | ||
stream, err := client.RequestLeaderData(context.Background(), &pb.LeaderDataRequest{}) | ||
if err != nil { | ||
Log.Error("Unable to request user data") |
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 should not just continue if this fails.
return errors.New("Node is not leader") | ||
} | ||
for { | ||
select { |
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 probably needs to respect the quit channel in some way, otherwise it will just run for ever.
Also, maybe it should add itself to the wait group.
Backend for the visualisation
Relates to #387 and #383