Plugin architecture example similar to Apache http server

291 views
Skip to first unread message

bsr

unread,
Oct 4, 2011, 3:19:37 PM10/4/11
to golang-nuts
Hello,
I read in the forum about plugin architecture, mainly about loading
modules dynamically. But, is there an example or program which I can
study to learn about plugin architecture, organization of source code,
static loading though config file etc. A good example, may be from the
go core itself, would be helpful. Outside go, I see examples Apache
server (C), Drupal (php).
Thank you.
Bsr

Kyle Lemons

unread,
Oct 4, 2011, 4:44:43 PM10/4/11
to bsr, golang-nuts
Hello,
 I read in the forum about plugin architecture, mainly about loading
modules dynamically.
Go does not have dynamic loading of modules.  It's been said that it's on the Go Team's radar, but they said at the time that nobody was working on it (and I don't think I've seen them say otherwise since).  Your best bet might be to have separate modules that communicate via RPC or some similar mechanism.

~K

Alexey Gokhberg

unread,
Oct 4, 2011, 3:55:31 PM10/4/11
to golang-nuts
There is little to say about the plugin architecture in Go since the
present Go implementations do not (yet?) support dynamic module
loading.

Here however you can find a description of the virtual machine that
has been used with one of Go predecessors did support dynamic modules:

http://doc.cat-v.org/inferno/4th_edition/dis_VM_specification

Diligent study of this text can reveal a lot about the design of
architectures of this kind.

And this is a classical book describing in the very detail design and
architecture of another system based on dynamic modules:

http://www.amazon.de/Project-Oberon-Design-Operating-Compiler/dp/0201544288

(and, by the way, Oberon described in this book might have certain
influence over design of Go).

Good luck!

bsr

unread,
Oct 4, 2011, 10:29:39 PM10/4/11
to golang-nuts
Thank you all for the help. May be I worded wrongly. I was not looking
for dynamic loading of plugin, but static. I read Apache server is
written in C, and still uses modules/plugins for extending basic
functionality. I do not mind changing the configuration file and
recompiling when I install new plugin. What I really was looking for a
go way of implementing an architecture where others can extend the
core functionality through plugins. I have very basic idea of hooks
and template pattern, but if there an implementation in go as an
example, I could see how to do it idiomatic go.

thanks

On Oct 4, 3:55 pm, Alexey Gokhberg <express...@unicorn-
enterprises.com> wrote:
> There is little to say about the plugin architecture in Go since the
> present Go implementations do not (yet?) support dynamic module
> loading.
>
> Here however you can find a description of the virtual machine that
> has been used with one of Go predecessors did support dynamic modules:
>
> http://doc.cat-v.org/inferno/4th_edition/dis_VM_specification
>
> Diligent study of this text can reveal a lot about the design of
> architectures of this kind.
>
> And this is a classical book describing in the very detail design and
> architecture of another system based on dynamic modules:
>
> http://www.amazon.de/Project-Oberon-Design-Operating-Compiler/dp/0201...
Message has been deleted

bsr

unread,
Oct 5, 2011, 12:16:16 AM10/5/11
to golang-nuts
Thank you so much.. that should be a good starting point.

On Oct 4, 11:33 pm, "d_smith...@rocketmail.com"
<d_smith...@rocketmail.com> wrote:
> The standard http package, Mango and Twister all have an extensible
> architecture.  Here are a couple of examples showing how the standard http
> package can be extended:
>
> - The standard expvar (http://golang.org/pkg/expvar/) and http/pprof
> (http://golang.org/pkg/http/pprof/) packages automatically register handlers
> when they are linked into an application.
>
> - The Gorilla Web Toolkit (http://gorilla-web.appspot.com/) has middleware
> for routing (http://gorilla-web.appspot.com/pkg/gorilla/mux/),  
>
> - The Gorilla Web Toolkit also includes a context package
> (http://gorilla-web.appspot.com/pkg/gorilla/context/) for
> associating arbitrary data with a request as the request is passed through a
> chain of middleware.

Anthony Martin

unread,
Oct 4, 2011, 11:06:24 PM10/4/11
to bsr, golang-nuts
bsr <bsr...@gmail.com> once said:
> Thank you all for the help. May be I worded wrongly. I was not looking
> for dynamic loading of plugin, but static. I read Apache server is
> written in C, and still uses modules/plugins for extending basic
> functionality. I do not mind changing the configuration file and
> recompiling when I install new plugin. What I really was looking for a
> go way of implementing an architecture where others can extend the
> core functionality through plugins. I have very basic idea of hooks
> and template pattern, but if there an implementation in go as an
> example, I could see how to do it idiomatic go.

Take a look at the code for the image package, specifically
the way RegisterFormat allows extending the Decode function
for new image types.

Cheers,
Anthony

Reply all
Reply to author
Forward
0 new messages