Homework 1 forum

func (g *Gossiper) GetNodes() []string VS func (g *Gossiper) GetDirectNodes() []string

 
Picture of Bastien Wermeille
func (g *Gossiper) GetNodes() []string VS func (g *Gossiper) GetDirectNodes() []string
by Bastien Wermeille - Tuesday, 20 October 2020, 20:44
 

Hello,

I was wondering, what is the difference between those two functions:

// GetNodes implements gossip.BaseGossiper. It returns the list of nodes this gossiper knows currently in the network.

func (g *Gossiper) GetNodes() []string

// GetDirectNodes implements gossip.BaseGossiper. It returns the list of nodes whose routes are known to this node

func (g *Gossiper) GetDirectNodes() []string

Best regards,

Bastien

Picture of Peter Krcmar
Re: func (g *Gossiper) GetNodes() []string VS func (g *Gossiper) GetDirectNodes() []string
by Peter Krcmar - Wednesday, 21 October 2020, 23:05
 

The way I understood it is GetNodes returns the addresses of known peers i.e. strings of format IP:PORT and GetDirectNodes returns the identifiers/names of nodes it has heard of thanks to rumors (basically all nodes it has a NextHop to).

Picture of Pasindu Nivanthaka Tennage
Re: func (g *Gossiper) GetNodes() []string VS func (g *Gossiper) GetDirectNodes() []string
by Pasindu Nivanthaka Tennage - Friday, 23 October 2020, 15:44
 

Hello

Thank you for the question.

func (g *Gossiper) GetNodes() []string has the same definition we have in HW0; so I assume it is clear.

func (g *Gossiper) GetDirectNodes() []string should return the set of nodes whose routes are known; for example if node A knows that it can send a private message to C via B, then C should be returned in this method.

Regards