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

Rewrite server implementations with GModule #182

Merged
merged 15 commits into from Jun 6, 2016

Conversation

Projects
None yet
2 participants
@arteymix
Member

arteymix commented Jun 4, 2016

Server implementations would be installed in ${LIBDIR}/vsgi/servers and loaded automatically with Server.@new.

An API for explicitly loading server implementation is provided by ServerModule.

We would need support for subdir to install shared library in correct locations. (see mesonbuild/meson#580).

No GModule API are exposed, so we don't need to publicly require gmodule-2.0.

@arteymix arteymix added the enhancement label Jun 4, 2016

@arteymix arteymix added this to the 0.3.0 milestone Jun 4, 2016

@arteymix arteymix self-assigned this Jun 4, 2016

@arteymix

This comment has been minimized.

Show comment
Hide comment
@arteymix

arteymix Jun 4, 2016

Member

We have to set -rpath so that examples and tests could work. That would also cover usage as a subproject. Still need to figure how that should be done though.

The ServerModule still need to use the correct path, but that will be easier to test with support for subdir.

Also, we cannot dispose of the ServerModule, so we have to handle that case in Server.@new helper.

Maybe it would be nice to forward errors in the factory as well, but that would require a lot of try {} catch statements.

Member

arteymix commented Jun 4, 2016

We have to set -rpath so that examples and tests could work. That would also cover usage as a subproject. Still need to figure how that should be done though.

The ServerModule still need to use the correct path, but that will be easier to test with support for subdir.

Also, we cannot dispose of the ServerModule, so we have to handle that case in Server.@new helper.

Maybe it would be nice to forward errors in the factory as well, but that would require a lot of try {} catch statements.

@arteymix

This comment has been minimized.

Show comment
Hide comment
@arteymix

arteymix Jun 4, 2016

Member

@Bob131 What do you think about all this?

Member

arteymix commented Jun 4, 2016

@Bob131 What do you think about all this?

@arteymix

This comment has been minimized.

Show comment
Hide comment
@arteymix

arteymix Jun 4, 2016

Member

Once stabilized, it would be nice to provide docs for writting custom servers.

Member

arteymix commented Jun 4, 2016

Once stabilized, it would be nice to provide docs for writting custom servers.

arteymix added some commits May 30, 2016

vsgi: Rewrite implementations using GModule
Extract common CGI and mock code back into VSGI to avoid dependency
between implementations. The CGI base is versioned for the '0.3' major.

Examples do not work yet because we need to set 'rpath' correctly.

Merge FastCGI and SCGI tests in CGI tests because implementations can
only be tested from outside.
vsgi: Move implementations in 'src/vsgi/servers'
This is necessary since they must be loadable from a single location in
the build directory. This should be ensured by '-rpath' linker option.
In the meantime, 'LD_LIBRARY_PATH' can be exported:

    LD_LIBRARY_PATH=src/vsgi/servers examples/app/app

Remove pkg-config and deps files.
vsgi: Add '-rpath' to the linker include 'src/vsgi/servers' in the se…
…arch path

Examples work and subprojects should work as well.
vsgi: Use a 'GLib.HashTable' to load multiple servers with 'Server.@new'
This allow one to obtain multiple instances of different server
implementations.

Fix the FastCGI server tests since it calls 'Server.@new' twice with the
same implementation.
@arteymix

This comment has been minimized.

Show comment
Hide comment
@arteymix

arteymix Jun 4, 2016

Member

Nice, now examples and tests work!

There's an environment variable that can be set to look for server implementations. No cascading for now, although it might be interesting in the near future. I feel quite against loading servers in user directories.

The only missing thing is to pass the initial server directory used by Meson and this will be perfect!

Member

arteymix commented Jun 4, 2016

Nice, now examples and tests work!

There's an environment variable that can be set to look for server implementations. No cascading for now, although it might be interesting in the near future. I feel quite against loading servers in user directories.

The only missing thing is to pass the initial server directory used by Meson and this will be perfect!

vsgi: Set '-rpath' relative to '$ORIGIN' now and after installation
Using '$ORIGIN' makes it possible to refer to relative directory for
searching server implementations.

After the installation, the '-rpath' is set to '$ORIGIN/vsgi/servers' so
that it reflects the system-wide folder.
@arteymix

This comment has been minimized.

Show comment
Hide comment
@arteymix

arteymix Jun 4, 2016

Member

Ok, that work as well! :) I used -rpath and $ORIGIN to refer relatively to the server path.

Member

arteymix commented Jun 4, 2016

Ok, that work as well! :) I used -rpath and $ORIGIN to refer relatively to the server path.

vsgi: Use 'Server.@new' as a more generic factory
Replace previous usages with 'Server.new_with_application' which
initialize the instance with an initial application callback.
@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Jun 5, 2016

Current coverage is 69.43%

Merging #182 into master will increase coverage by 2.68%

@@             master       #182   diff @@
==========================================
  Files            24         28     +4   
  Lines           779       1050   +271   
  Methods           0          0          
  Messages          0          0          
  Branches         90        119    +29   
==========================================
+ Hits            520        729   +209   
- Misses          233        321    +88   
+ Partials         26          0    -26   

Powered by Codecov. Last updated by a1dcffe...8554ee0

codecov-io commented Jun 5, 2016

Current coverage is 69.43%

Merging #182 into master will increase coverage by 2.68%

@@             master       #182   diff @@
==========================================
  Files            24         28     +4   
  Lines           779       1050   +271   
  Methods           0          0          
  Messages          0          0          
  Branches         90        119    +29   
==========================================
+ Hits            520        729   +209   
- Misses          233        321    +88   
+ Partials         26          0    -26   

Powered by Codecov. Last updated by a1dcffe...8554ee0

vsgi: Add tests to cover 'Server.new'
Ensure that basic implementations exist and can be successfully loaded.
@arteymix

This comment has been minimized.

Show comment
Hide comment
@arteymix

arteymix Jun 5, 2016

Member

I'm finishing the documentation and it should be ready to merge.

Member

arteymix commented Jun 5, 2016

I'm finishing the documentation and it should be ready to merge.

@arteymix arteymix merged commit 174918d into master Jun 6, 2016

2 of 4 checks passed

codecov/patch 50.00% of diff hit (target 66.75%)
Details
codecov/project 61.65% (-5.10%) compared to a1dcffe
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@arteymix arteymix deleted the vsgi-rewrite-server-with-gmodule branch Jun 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment