digitalmars.D - Aerospike wrapper/driver for vibe.d ?
- Rico Decho (18/18) Jan 28 2017 I'm new to the D language, but I really enjoy its execution speed
- rikki cattermole (4/20) Jan 28 2017 I wouldn't worry about writing a wrapper just yet.
- Rico Decho (4/4) Jan 28 2017 I agree, one step at a time...
- Mike Parker (5/9) Jan 28 2017 You shouldn't need any of that to create a binding to a C API.
- John Colvin (26/30) Jan 28 2017 Binding to C is really, really easy for most cases. E.g. for a
- Rico Decho (6/6) Jan 28 2017 This afternoon I'll first try using dstep to generate the binding
- Mike Parker (3/9) Jan 28 2017 Be sure to pay a visit to the Wiki for some help:
- Rico Decho (3/3) Jan 28 2017 Actually I think that John's explanations are much more concrete
- Mike Parker (7/10) Jan 28 2017 Simply because no one has bothered to do it? The Wiki page links
- Rico Decho (3/3) Jan 28 2017 Thanks for proposing it !
- John Colvin (2/5) Jan 30 2017 that's fine :)
- Rico Decho (8/8) Feb 09 2017 I've finally stopped working on Aerospike's wrapper.
- rikki cattermole (3/11) Feb 09 2017 I had a look at the other posts on that forum, it isn't exactly active
- Rico Decho (1/1) Feb 09 2017 Indeed.
I'm new to the D language, but I really enjoy its execution speed and ease of programming, and I'd like to implement the web server of my next project in D instead of C++ or Go. Unfortunately my server needs to communicate with an Aerospike database (an ultra-fast open-source distributed database). Aerospike provides a client API for plenty of languages (C, C++, Go, JS, Ruby, Python, etc) but unfortunately not for D. So I'd like to know if anybody has already begun to build a wrapper around Aerospike's C API, preferably one that automatically converts class fields to record bins (and inversely). I'm trying to implement this by myself, but honestly it's not easy for a newcomer like me... That's really sad, because IMHO, this driver could definitely help D in becoming THE mainstream language for high-performance web servers, outperforming even C++ and Go, as obviously the Dlang/Aerospike combination feels really optimal for this kind of development.
Jan 28 2017
On 28/01/2017 10:15 PM, Rico Decho wrote:I'm new to the D language, but I really enjoy its execution speed and ease of programming, and I'd like to implement the web server of my next project in D instead of C++ or Go. Unfortunately my server needs to communicate with an Aerospike database (an ultra-fast open-source distributed database). Aerospike provides a client API for plenty of languages (C, C++, Go, JS, Ruby, Python, etc) but unfortunately not for D. So I'd like to know if anybody has already begun to build a wrapper around Aerospike's C API, preferably one that automatically converts class fields to record bins (and inversely). I'm trying to implement this by myself, but honestly it's not easy for a newcomer like me... That's really sad, because IMHO, this driver could definitely help D in becoming THE mainstream language for high-performance web servers, outperforming even C++ and Go, as obviously the Dlang/Aerospike combination feels really optimal for this kind of development.I wouldn't worry about writing a wrapper just yet. Get a binding going first. If you would like some interactive help jump on to #D on Freenode (IRC).
Jan 28 2017
I agree, one step at a time... Anyway, as I've never used D's type introspection and compile-time code generation, my options are quite limited at the moment :(
Jan 28 2017
On Saturday, 28 January 2017 at 09:59:10 UTC, Rico Decho wrote:I agree, one step at a time... Anyway, as I've never used D's type introspection and compile-time code generation, my options are quite limited at the moment :(You shouldn't need any of that to create a binding to a C API. You can manually translate the headers or use a tool like DStep [1] to get you most of the way there. [1] https://github.com/jacob-carlborg/dstep
Jan 28 2017
On Saturday, 28 January 2017 at 09:59:10 UTC, Rico Decho wrote:I agree, one step at a time... Anyway, as I've never used D's type introspection and compile-time code generation, my options are quite limited at the moment :(Binding to C is really, really easy for most cases. E.g. for a library called fancyLib with a C header fancyLib.h // fancyLib.h, just for reference struct S { int a, b; } char const *fancyCFunction(int a, long b, struct S s); //fancyLib.d import core.stdc.config : c_long; struct S { int a, b; } extern(C) const(char)* fancyCFunction(int a, c_long b, S s); //myCode.d import fancyLib; void main() { auto res = fancyCFunction(4, 53, S(1, 1)); } compile with: dmd fancyLib.d myCode.d -L-lfancyLib or add fancyLib to "libs" if you use dub.
Jan 28 2017
This afternoon I'll first try using dstep to generate the binding automatically. If that doesn't work as expected, I'll try to bind the main functions manually as detailed in the "fancylib" example... In both cases, at least now I'm confident that I know precisely how to proceed, so thanks guys for the tips :)
Jan 28 2017
On Saturday, 28 January 2017 at 12:34:21 UTC, Rico Decho wrote:This afternoon I'll first try using dstep to generate the binding automatically. If that doesn't work as expected, I'll try to bind the main functions manually as detailed in the "fancylib" example... In both cases, at least now I'm confident that I know precisely how to proceed, so thanks guys for the tips :)Be sure to pay a visit to the Wiki for some help: http://wiki.dlang.org/Bind_D_to_C
Jan 28 2017
Actually I think that John's explanations are much more concrete and useful than what's in the official docs. Why not integrate it into D's wiki ?
Jan 28 2017
On Saturday, 28 January 2017 at 15:01:00 UTC, Rico Decho wrote:Actually I think that John's explanations are much more concrete and useful than what's in the official docs. Why not integrate it into D's wiki ?Simply because no one has bothered to do it? The Wiki page links to some stuff I wrote over at gamedev.net that covers most of the common cases and fills in some stuff I didn't. I also devoted an entire chapter to it, where I covered more cases, in Learning D. If anyone wants to take all of that and combine it into a Wiki page, it's fine by me.
Jan 28 2017
Thanks for proposing it ! I've just added John's sample code to the wiki (hoping that he doesn't mind).
Jan 28 2017
On Saturday, 28 January 2017 at 16:52:29 UTC, Rico Decho wrote:Thanks for proposing it ! I've just added John's sample code to the wiki (hoping that he doesn't mind).that's fine :)
Jan 30 2017
I've finally stopped working on Aerospike's wrapper. My company has finally decided to use another database (probably CouchBase). Anyway, I had noticed an obvious lack of interest of Aerospike's company for the D language. It's not even worth any short answer (even negative) to a request for a D client API on their forum. https://discuss.aerospike.com/t/aerospike-d-client-api/3810
Feb 09 2017
On 09/02/2017 9:03 PM, Rico Decho wrote:I've finally stopped working on Aerospike's wrapper. My company has finally decided to use another database (probably CouchBase). Anyway, I had noticed an obvious lack of interest of Aerospike's company for the D language. It's not even worth any short answer (even negative) to a request for a D client API on their forum. https://discuss.aerospike.com/t/aerospike-d-client-api/3810I had a look at the other posts on that forum, it isn't exactly active by the employees.
Feb 09 2017