Skip to content

Permanent id: UUID or node name? #715

@joaofl

Description

@joaofl

I recently started experimenting with zyre, and so far It has been a great experience (congrats for the dev team!).

But there is one specific requirement in my use case which I still could not tell how to address. I will have one node on the network with some logical "leadership", named MASTER. It will delegate functions to the other nodes on the network, which will in turn execute tasks, and eventually communicate back to the master what was done.

To my understanding, for that to happen I would need to keep track of the node name and UUID upon the reception of a message, in some sort of dictionary, such that I can tell later which UUID the node with name "MASTER" has, so I can WHISPER to it. But many problem rise the minute I try to keep track of the pair UUID:name. That is because the UUID is random, so each time a node restarts, my dictionary may not be yet up to date, and lead to undesirable behaviors.

So I see two solutions here... One is to have a fixed UUID to the entire lifetime of the product. In that case the UUID could be a hash of the MAC for example. But yet, I saw no way to set the UUID manually at the node creation. That would enable predictable constant and yet unique UUIDS.

Another approach could be to have some sort of get_peer_uuid_from_name method. So that way I could WHISPER to the MASTER without necessarily keeping track of its UUID.

There is already a method in "zyre_peer.h" that almost accomplish that: zyre_peer_name, but it is not exposed to the outside. That is used by the zyre_print(node) method, which already matches the UUID and the name of each known peer.

Meaning that the information is already there, but I cannot find the means to use it in my favor.

I: 22-09-11 21:20:55 zyre_node: dump state
I: 22-09-11 21:20:55  - name=node00 uuid=F43D738091434BDB893814089E51D0FB
I: 22-09-11 21:20:55  - endpoint=tcp://10.0.0.20:49161
I: 22-09-11 21:20:55  - discovery=beacon port=5670 interval=0
I: 22-09-11 21:20:55  - headers=0:
I: 22-09-11 21:20:55  - peers=2:
I: 22-09-11 21:20:55    - uuid=B2A896FB3F594B63B6B468A67125FD66 name=MASTER endpoint=tcp://10.0.0.20:49158 connected=yes ready=yes sent_seq=1 want_seq=2
I: 22-09-11 21:20:55    - uuid=5036DF662EAF423FB536C9C3270AEE81 name=node02 endpoint=tcp://10.0.0.20:49159 connected=yes ready=yes sent_seq=1 want_seq=1
I: 22-09-11 21:20:55  - own groups=1:
I: 22-09-11 21:20:55    - GROUP
I: 22-09-11 21:20:55  - peer groups=1:
I: 22-09-11 21:20:55    - GROUP
I: 22-09-11 21:20:55      - B2A896FB3F594B63B6B468A67125FD66
I: 22-09-11 21:20:55      - 5036DF662EAF423FB536C9C3270AEE81

Any suggestions on how to correctly address that?

I am willing to contribute to project, and add any functionalities if they make sense at all.

Kind regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions