Change the API of Discoverer to not be GAsyncResult based

Review Request #1897 — Created Oct. 6, 2022 and submitted

Information

traversity/traversity
default

Reviewers

The rational behind this can be found in TRAVERSITY-8.

The existing API was left for now, so we can port TraversityUpnpDiscoverer and
then delete it after that port is done.

We also need to add glib-mkenums for this change.

Compiled

Summary ID
Change the API of Discoverer to not be GAsyncResult based
The rational behind this can be found in TRAVERSITY-8. The existing API was left for now, so we can port TraversityUpnpDiscoverer and then delete it after that port is done. We also need to add glib-mkenums for this change.
54d0c57380d4d83469f6a308cfefb67869fdae34
Description From Last Updated

Transfer full?

QuLogicQuLogic

meant

QuLogicQuLogic

Is there a reason this isn't called set_status?

QuLogicQuLogic
ivanhoe
  1. 
      
  2. traversity/traversitydiscoverer.c (Diff revision 1)
     
     

    Shouldn't we check here also that the status is not already TRAVERSITY_DISCOVERER_STATUS_DISCOVERING?

    1. Whoops, good call!

  3. 
      
grim
ivanhoe
  1. Ship It!
  2. 
      
QuLogic
  1. 
      
  2. traversity/traversitydiscoverer.h (Diff revision 2)
     
     
    Show all issues

    Transfer full?

  3. traversity/traversitydiscoverer.h (Diff revision 2)
     
     
    Show all issues

    meant

  4. traversity/traversitydiscoverer.h (Diff revision 2)
     
     
    Show all issues

    Is there a reason this isn't called set_status?

    1. If this was named set_status, would that mean that calling it with TRAVERSITY_DISCOVERER_STATUS_DISCOVERING would start the process and then we remove traversity_discoverer_discover?

      The reason I didn't name this set status was that the traversity_discoverer_discover and traversity_discoverer_discover_finished seem to pair better and that traversity_discoverer_discover_finish was less likely to be called by users of the library.

    2. If this was named set_status, would that mean that calling it with TRAVERSITY_DISCOVERER_STATUS_DISCOVERING would start the process and then we remove traversity_discoverer_discover?

      That would be confusing. But if the name stays traversity_discoverer_discover_finished shouldn't it either not be possible or at least produce a warning when calling it with TRAVERSITY_DISCOVERER_STATUS_DISCOVERING? Because in my mind it doesn't make sense to finish something with an "in progress status". You couldn't abuse the function in traversity_discoverer_discover then though...

    3. We can add that check, it doesn't really matter the question is how should this API work.. We need to get that figured out so we can actually start progressing with this and sitting for 8+ days isn't something I was aiming for.

    4. I agree we want to discourage users calling it, but it's weird to call it _finished when it's called multiple times to update progress. I guess partly I misread it as _finished when you intended _discover_finished as the verb. Perhaps something like tranversity_discoverer_update_status?

    5. traversity_discoverer_update_status could work, but I'm wondering if we should just ditch _discover and have set_status do all the things, including calling the abstract method if the state is discovering.

    6. I think it's fine to be separate. Might be confusing for users to mix both types of status 'setting'.

    7. I actually left it as 2 separate methods in the most recent code update.

  5. 
      
grim
grim
QuLogic
  1. Ship It!
  2. 
      
grim
Review request changed
Status:
Completed