Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ppodhajski
Copy link
Contributor

No description provided.

@ppodhajski ppodhajski requested a review from dnachbaur March 10, 2017 10:28
@ppodhajski ppodhajski force-pushed the feature/genericServer branch from f27a7ff to 9998e4d Compare March 14, 2017 07:43
@rdumusc rdumusc requested review from rdumusc and removed request for dnachbaur March 20, 2017 14:15
@rdumusc rdumusc assigned eile and unassigned dnachbaur Mar 20, 2017
eile pushed a commit to eile/ZeroEQ that referenced this pull request Mar 21, 2017
eile pushed a commit to eile/ZeroEQ that referenced this pull request Mar 21, 2017
eile pushed a commit to eile/ZeroEQ that referenced this pull request Mar 21, 2017
@rdumusc rdumusc self-assigned this Mar 24, 2017
@rdumusc rdumusc removed their request for review March 24, 2017 15:38
@ppodhajski ppodhajski force-pushed the feature/genericServer branch 3 times, most recently from ea5787f to 55b37a5 Compare March 27, 2017 11:25
doc/Changelog.md Outdated
* set a response header, including content type.
* set a custom response payload for all action verbs.
* return a future and and avoid blocking of the main thread.
* return an std::future to avoid blocking the main thread.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • use a std::future

Copy link
Contributor

Choose a reason for hiding this comment

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

scratch that.

doc/Changelog.md Outdated
* return an std::future to avoid blocking the main thread.
* register a single endpoint for collections.
* filter collections using a query string with a GET request
* filter collections using a query string with GET requests.
Copy link
Contributor

Choose a reason for hiding this comment

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

Style: no '.' at the end (most items are like that)

std::promise<T> promise;
promise.set_value( value );
return promise.get_future();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel somewhat strongly about not having this as part of the zeroeq API. It does not belong here, but to lunchbox/extra. I hid it on purpose in my CR for that reason, until we figure the above out.

Copy link

@rdumusc rdumusc Apr 3, 2017

Choose a reason for hiding this comment

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

Yes, it is missing from the standard. It could go to this future Extra project above ZeroEQ at some point, but now I see two solutions:

  • make this header private like you had it and let users figure out how to make a ready Response.
  • new alternative: keep the header public but change the function to:
    std::future<Response> make_ready_response(...);
    forwarding the arguments to the Response constructor, as that is the only use case for this helper. I think this would be quite nice to use!

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with both.

Copy link

@kaabimg kaabimg Apr 3, 2017

Choose a reason for hiding this comment

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

You can avoid copy :

template < typename T >
std::future make_ready_future(T&& value)
{
std::promise promise;
promise.set_value(std::forward< T >(value));
return promise.get_future();
}

Copy link

Choose a reason for hiding this comment

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

@kaabimg you're perfectly right, this was an oversight. The new make_ready_response() function will correctly forward the arguments to the Response constructor.

};

/** HTTP codes to be used in a Response. */
enum Code
Copy link
Contributor

Choose a reason for hiding this comment

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

enum class

Copy link

Choose a reason for hiding this comment

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

I have a last-minute doubt about this. It felt somehow convenient (at least for the Tide unit tests) to have response.code directly comparable with integer values (200, 404) instead of having to use their enum name because many of those codes are well-known. What do you think?

@ppodhajski ppodhajski force-pushed the feature/genericServer branch 2 times, most recently from 60ab750 to faba37d Compare April 4, 2017 12:25
@ppodhajski ppodhajski force-pushed the feature/genericServer branch from 4af00dc to a6f1cfe Compare April 5, 2017 13:09
@ppodhajski ppodhajski force-pushed the feature/genericServer branch from a6f1cfe to 7b19030 Compare April 5, 2017 14:31
@rdumusc
Copy link

rdumusc commented Apr 5, 2017

restest this please

@rdumusc rdumusc merged commit c07c47e into HBPVIS:master Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants