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

[WIP] Visualisation Backend #406

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

VoyTechnology
Copy link
Member

Backend for the visualisation

Relates to #387 and #383

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "must be run"

Copy link
Member Author

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

@VoyTechnology VoyTechnology force-pushed the feature/voy/visualisation-backend branch 2 times, most recently from e256465 to 47e910e Compare April 21, 2016 16:11
Uuid: nodes[i].NodeID,
CommonName: nodes[i].CommonName,
State: "unknown",
Addr: nodes[i].IP+nodes[i].Port,
Copy link
Member Author

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();

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.

Copy link
Member Author

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()

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,

Choose a reason for hiding this comment

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

Is this go fmted?

Copy link
Member Author

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")

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 {

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.

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

Successfully merging this pull request may close these issues.

3 participants