Monday, 05 March 2018
A SWIG based framework to build Hotrod client prototype in your preferred language
If your are working on a non Java/C++/C#/JS application and you need to interact with Infinispan via Hotrod you may be interested in the idea behind the HotSwig[1] project.
Hotswig proposes a framework to build Hotrod client prototypes quickly and for a generic SWIG[2] supported language. As people familiar with C++ and C# Infinispan native clients know, SWIG plays a role in both the projects:
-
is used to build the base of the C# client wrapping the C++ core with a C# layer;
-
is used in the C project to run (part of) the Java test suite against the client, in this way: a Java wrapper is built via SWIG to make the C client looks like its Java big brother so it can be tested with the Java test suite.
The main goal was to produce for a specific language an almost complete client reusing the C++ core features and the following workflow has been setup to do that:
-
the whole C interface is processed by SWIG. The resulting wrapper exposes almost all the C functions;
-
a user friendly adaptation layer is build on top of the SWIG result.
This approach doesn’t work for the HotSwig goal, mainly because the effort need by the second step is usually not-negligible and prevents the rapid development of prototype in a generic language.
In the HotSwig approach, this limitation is removed moving the adaptation layer from the target language to the C++ side and then letting SWIG generate a ready to use client prototype. So the HotSwig workflow is the following:
-
build an adaptation facade around the C core to make it SWIG friendly (do the adaptation work once for all on the C side);
-
explicitly define what we want in the produced SWIG wrapper (keep things simple excluding everything by default);
-
run SWIG to produce the client.
At the moment HotSwig is just a proof of concept, but you can try to run it and produce a ready to work Infinispan client for the language you need. Examples are already provided for python, ruby and Octave, but HotSwig should work with all the SWIG supported languages. If you get it to run in your preferred programming language, please share your experience with us.
I’ve listed here[3] some tasks for the roadmap, with the idea to test the flexibility of the framework trying to extend it in different directions. Maybe the idea is good and it can grow up from a PoC to something that can really help devs. You can add you ideas of course.
So if you need to do math against your Infinispan data set why don’t you try the Octave client? Or maybe you want to do analytics with R, or presentation with PHP. Or you just like parenthesis and you want to use Lisp. Or you’re working for the Klingon empire and you must use ylDoghQo'[4]… well ok just joking now…
Thanks for reading!
Cheers The Infinispan Team
Tags: hotrod ruby cpp-client python
Monday, 21 February 2011
Infinispan Python client beta for Hot Rod servers is here!
The first beta version of the Infinispan native python client to connect to the Infinispan Hot Rod servers is available now from Infinispan’s GitHub repository or PyPi. Please check the latest README information to find out more about installation instructions.
So, what’s in it? For this first beta release, we’ve implemented all the operations available in the Hot Rod specification and they’ve been tested with string inputs. This release does not include code to deal with client intelligence superior to 1, so clients cannot receive notifications of cluster changes nor can they locate data in an intelligent manner by applying consistent hash algorithms to the keys. These capabilities, plus further examples such as how to integrate with payloads from Google Protocol Buffers will come in next beta releases.
If you’re looking for code examples for the Infinispan Python client, you can find a very basic one in the README file itself, or check the testsuite within the source package. In next releases we’ll be creating a wiki with more detailed examples.
As always, if you have any doubt please use the user forums and for any bugs or feature requests, please log them via JIRA.
Cheers, Galder
Tags: beta hotrod python