valum-framework / valum

Web micro-framework written in Vala
https://valum-framework.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
225 stars 23 forks source link

Rewrite server implementations with GModule #182

Closed arteymix closed 8 years ago

arteymix commented 8 years ago

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 https://github.com/mesonbuild/meson/issues/580).

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

arteymix commented 8 years ago

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 commented 8 years ago

@Bob131 What do you think about all this?

arteymix commented 8 years ago

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

arteymix commented 8 years ago

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!

arteymix commented 8 years ago

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

codecov-io commented 8 years ago

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

arteymix commented 8 years ago

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