This is a creation in Article, where the information may have evolved or changed.
has been learning go for some time, the progress of the translation of learning go language is as slow as before. Whenever you translate to a place and see the subtle design of the Go language, you will be tempted to write something. Well, in fact, my previous plan is to write a proxy, but still forget it, the reason we all understand. The wheels are too much to be boring.
The importance of Gearman in the system has been raised again and again in the process of collating some of the prior technical architectures and thinking about new architectures. It is not intended to use Golang in new projects, although it is based on the principle of "new projects with old technology, new technologies for old projects". However, one day the new project will become an old project? Will one day, the old project need to make some adjustments? The reason is far-fetched, but always find yourself a reason to do it.
So there's this: Http://bitbucket.org/mikespook/gearman-go.
The originally conceived version was for the mature libgearman to make a wrapper with CGO. Failed ... The reason is also very simple, there is no way to pass a golang func as a pointer to C.
The Pointer to do a Hacking to the unsafe, see there is no way to get a func pointer, then very 2B discovery, need to write in the note C way to do wrapper. Does it provide a 2B API that needs to write code in comments?
Tangled for a long time, so with Golang native realized a set of Gearman agreement. Thanks to Gearman, the protocol design is simple and the documentation is clear. More to thank Golang, the code is very happy to write, the implementation is very force.
– Installation
CD./src/pkg/gearman/make Install
– Routines
# Example/worker.gomake Worker./workerexample/client.gomake client./client
In the routine, I specifically provided an example of Python's Libgearman version of Wrapper, and for now, the Python version of the Federated Golang version works well.
Now that this package is just a running phase, I don't have any optimizations for the code or any coverage testing of the code. At the same time, performance and stability are all unknown.
To use it in a project, make sure you know what you're doing.
Any feedback on this package is welcome. In my blog here, or https://bitbucket.org/mikespook/gearman-go/issues.
Oh, by the way, before I actually use this package in my project, its API is unstable and can change at any time. If possible, I may offer gofix support, after all, I have not played this interesting thing.