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

Is replier_id always needed in Reply? #709

Open
Mallets opened this issue Feb 1, 2024 · 9 comments
Open

Is replier_id always needed in Reply? #709

Mallets opened this issue Feb 1, 2024 · 9 comments
Labels
api fix Correct API question Further information is requested release Part of the next release

Comments

@Mallets
Copy link
Member

Mallets commented Feb 1, 2024

Describe the release item

Reply includes a mandatory replier_id of type ZenohId.
However, the Sample accepted in the reply() contains a SourceInfo containing an optional ZenohId.

In the light of this, shouldn't replier_id be of type Option<ZenohId> instead of ZenohId? If ZenohId is always present in the Reply, then who is setting it all the time? Is this behaviour compatible with zenoh-pico?

@Mallets Mallets added the release Part of the next release label Feb 1, 2024
@Mallets
Copy link
Member Author

Mallets commented Feb 1, 2024

It seems the ZenohId is set in https://github.com/eclipse-zenoh/zenoh/blob/5601669ae4f1409e2080682acdb54a8f1d700ee8/zenoh/src/session.rs#L2400C58-L2400C65.
I believe the current behaviour is not the expected one and the replier_id should be an Option<ZenohId>.

@Mallets
Copy link
Member Author

Mallets commented Feb 1, 2024

Linking C structure in zenoh-pico: z_reply_data_t

@p-avital
Copy link
Contributor

p-avital commented Feb 1, 2024

IIRC, the distinction is there so that storages that reply can be identified, while the sample would retain its original SourceInfo. @OlivierHecart?

@milyin milyin added the enhancement Existing things could work better label Feb 1, 2024
@milyin milyin moved this to Backlog in Zenoh 1.0.0 release Feb 1, 2024
@milyin milyin added question Further information is requested and removed enhancement Existing things could work better release Part of the next release labels Mar 12, 2024
@milyin milyin closed this as completed Jun 14, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in Zenoh 1.0.0 release Jun 14, 2024
@milyin
Copy link
Contributor

milyin commented Jul 2, 2024

@Mallets @OlivierHecart
@DariusIMP noticed, that there is a problem with this issue. Before the fix the reply_id was set to random, which was definitely wrong: https://github.com/eclipse-zenoh/zenoh/pull/1138/files#diff-f0aac9d83f0d53d0be9a6ee02269c26605c3920dbd6782f744e59c21aec235d5L2311

But it seems that this field is unrelated to SourceId field of the sample. In case of error this field is set to zid of the replying session. I see no reason to not to do the same for normal replies. So maybe we should remove this option and just always set this field with current session zid ?

@milyin milyin reopened this Jul 2, 2024
@milyin milyin added release Part of the next release api fix Correct API labels Jul 2, 2024
@OlivierHecart
Copy link
Contributor

@Mallets @OlivierHecart @DariusIMP noticed, that there is a problem with this issue. Before the fix the reply_id was set to random, which was definitely wrong: https://github.com/eclipse-zenoh/zenoh/pull/1138/files#diff-f0aac9d83f0d53d0be9a6ee02269c26605c3920dbd6782f744e59c21aec235d5L2311

But it seems that this field is unrelated to SourceId field of the sample. In case of error this field is set to zid of the replying session. I see no reason to not to do the same for normal replies. So maybe we should remove this option and just always set this field with current session zid ?

replier_id has indeed nothing to do with SourceId. The reason for making this an Option is that sometimes we might not have the information on the real replier or there may not be a clearly identifiable replier (infrastructure error for example). In such cases it's better to set None rather to mislead users to believe that the local session replied.

@milyin milyin closed this as completed Jul 2, 2024
@milyin
Copy link
Contributor

milyin commented Jul 2, 2024

@OlivierHecart also mentioned, that it's probably better to use EntityGlobalId here instead of ZenohId

@milyin milyin reopened this Jul 2, 2024
@milyin
Copy link
Contributor

milyin commented Jul 2, 2024

image

@stepkun
Copy link

stepkun commented Jul 5, 2024

Imho the fields/structs source_id & replier_id should either be reliable or removed.
In case they are not reliable, users who need that information have to implement and transport the information themselves, so they are obsolete and only bloating the transported data amount.
And in case they are reliable, access methods need not return an Option anymore - will make programmers life much easier.

@milyin
Copy link
Contributor

milyin commented Jul 5, 2024

@stepkun thank you for your thoughts
After discussion with @OlivierHecart and @Mallets it was decided to put this option under "unstable" until final solution. Anyway there is no coherent way to set it on sending side, so before it's done let's keep it unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api fix Correct API question Further information is requested release Part of the next release
Projects
Status: Done
Development

No branches or pull requests

5 participants