<lisael>
it's not usable at the moment, ( I only support I32 fields :D )
<lisael>
I'm still looking for the best achitecture and API
<lisael>
but it's here and you're welcome to contribute :D
mvzink has joined #ponylang
<lisael>
The internal architecture is sort-of stable, now, I guess I should document a bit.
<titi>
Why don't you think it's a good idea to re-write sqlite in pony? I cannot make any promise about using/testing (contributing to) pony-postgres, but it could be an alternative to look into. if only i could understand your advice.
mvzink has quit [Ping timeout: 241 seconds]
<lisael>
sqlite is a self-contained db lib. The lib is almost its own spec, it would be very hard to rewrite something that produces exactly the same db files and to port all evolutions and bug fixes in a re-implementation
<lisael>
postgres is client-server, the only part we have to implement to be pg-compliant is the protocol which is well defined and well bound
<lisael>
BTW, I'm not aware of a ffi-wrapper for sqlite, if you don't find one and go that way, could you release it a a separate library, please, titi ?
mvzink has joined #ponylang
<lisael>
(i think we should define a common API for all SQL drivers, but I have not even documented pony-pg API. I have no proposition at the moment)
<titi>
i'll contribute as much as i can to this
<titi>
thank you
dinfuehr_ has joined #ponylang
mvzink has quit [Ping timeout: 250 seconds]
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 268 seconds]
NhanH__ is now known as NhanH
mvzink has joined #ponylang
mvzink has quit [Ping timeout: 260 seconds]
<SeanTAllen>
there are a couple of sqlite wrappers out there. someone mentioned doing an "Awesome Pony" repo to start collecting together links.
<titi>
'pony orm' is unfortunately misleading: it's a python thing
<titi>
i cannot find anything else
<Candle>
lisael: common api for sql, like jdbc? ¬_¬ ?
<SeanTAllen>
TwoNotes worked on a couple but he isnt online right now
<Candle>
(In terms of, a common api would be great!, but try to avoid the mistakes that jdbc made)
<lisael>
titi: looks like SeanTAllen's link is what you need. I think it's short in terms of data types and roughly exposes the low level C API, but it's a great start, for you
goircbot has quit [Max SendQ exceeded]
mvzink has quit [Ping timeout: 240 seconds]
<titi>
yes, sorry for not reacting.
goircbot has joined #ponylang
<titi>
i'm wondering about databases and the actor model now. is there something i can read about it?
goircbot has quit [Max SendQ exceeded]
<SeanTAllen>
what is the "it" in that sentence titi?
<lisael>
how does well known actor models do ? Elixir? Akka?
<lisael>
(I think I'll give a look at pdtwonotes' LMDB and leveldb wrappers too :) )
<malthe>
i think erlang at least has a different model because it'll actually block the actor (synchronous).
goircbot has joined #ponylang
<SeanTAllen>
in general, you probably want to approach it similar to how pony does TCPConnection. You have an actor that manages a database connection and can receive notification of events as they happen. its a good first approach to try. cant guarantee it is the right approach but in general, its a good place to start from.
<titi>
it stands for "dbs and the actor model", i suppose that it must be done differently (unless using ffi)
<lisael>
in pony-pg, at the moment I use notifier pattern a lot
<titi>
thanks
<SeanTAllen>
its also quite possible that you want/need promises to really make it work.
mvzink has joined #ponylang
<SeanTAllen>
as malthe says, other actor models might not provide much help if they are synchronous
<SeanTAllen>
if you database isn't in any way event driven, you could implement it ala File as a synchronous class BUT that results in serious scheduler issues if you have long running queries so, you should probably rule that out
jemc has joined #ponylang
<malthe>
I think promises is the way to go since it accurately mirrors how the protocol works, at least in the case of pg.
<malthe>
you send a query and its success or failure.
<malthe>
SeanTAllen: did you see my promises-related question on the mailing-list?
<lisael>
that in turn notifies a user-facing notifier when there's a result to expose (a row in a result or any event). I added message batching to avoid scheduler storms
goircbot has quit [Remote host closed the connection]
<lisael>
I doubt this is needed for sqlite BTW
<malthe>
lisael: can you batch rows too?
<malthe>
python's generators are neat but lack buffering/batching really.
<lisael>
yes, i do it internally at the moment,
<malthe>
you could start a promise for N rows.
<malthe>
seems like the js community benefited a lot from everyone just using promises for most APIs.
<malthe>
(when applicable)
goircbot has joined #ponylang
<lisael>
malthe: you mean internally or for the user ?
<malthe>
for the user actually.
<lisael>
what would be the API in your idea?
<malthe>
instead of you providing a callback, or a notifier, you post a sort of request (e.g. for N rows of a query result) and get back a promise.
<lisael>
(I don't use promises a lot, I don't know them)
<lisael>
and if the result has more rows ?
<lisael>
you post a second request at any time ?
<malthe>
you know because number of rows returned equalled your N that it may have more rows.
<malthe>
that said, you probably should be using a completely declarative / stream-based approach to processing query results.
<lisael>
malthe: intersting, really, I'm adding a promise API before I try to make something usefull with the lib
goircbot has quit [Remote host closed the connection]
goircbot has joined #ponylang
<malthe>
I do think that Pony's non-deadlocking design changes how you'll want to write code.
goircbot has quit [Max SendQ exceeded]
goircbot has joined #ponylang
<lisael>
yup, I come from Python/asyncio, go, and elixir background in terms of async programming, and every time I'm frustrated because I'd like a blocking call, I recall why blocking is bad, and why I like pony, I calm down and I find a new way to do it :)
goircbot has quit [Remote host closed the connection]
<malthe>
it's been said some times on this channel that pony really is a functional language, and in the sense of not having (emulated) blocking calls, it's true.
Praetonus has joined #ponylang
goircbot has joined #ponylang
goircbot has quit [Remote host closed the connection]
<malthe>
SeanTAllen: the context of my example is that i'm trying to implement asynchronous name resolving since currently pony makes a blocking call.
xshuiniu has joined #ponylang
<malthe>
I thought I'd try and model it as an `IPEndpoint` that can resolve to an `IPAddress` which is already an IP4 or IP6 address plus a 16-bit port.
<malthe>
If this was a success, then it might improve the API to TCP connector/listener so that it doesn't need multiple constructors.
amclain has joined #ponylang
<SeanTAllen>
I'm doing a lot of work on the TCP code in our fork of Pony which is resulting in a number of RFCs that are either written or will be written and we are doing a serious rewrite that might eventually result in ideas for mainline Pony once we validate them in our product.
jemc has quit [Read error: Connection reset by peer]
jemc has joined #ponylang
trapped has quit [Quit: int random { /* ensure randomness */ return 3; }]
<malthe>
sounds interesting
<lisael>
anyone has a piece of code that connects to a unix socket ?
<lisael>
(is it possible in the first place)
<malthe>
it's possible, but there is no support for it in the stdlib currently.
<jemc>
lisael: should be possible, but you'll need to deal with FFI and with asio events
<jemc>
one of my short term goals is to try to abstract the IO-handling parts of actors like TCPConnection and ProcessMonitor
<malthe>
it should be possible to rework the tcp code so that it can support any data stream.
<jemc>
(so that we can add more stdlib IO types, and users can easily create their own as well)
<lisael>
:/ I've never even read the code in asio, I suppose it's time :)
<jemc>
lisael: if you needed a solution quickly, I'd suggest copying `net/tcp_connection.pony` and reworking to use unix sockets
<lisael>
I'm not in a hurry, it's for postgres. I have a lot to do before re-working on connections
<lisael>
however, I've guessed that the solution would look like tcp, so I wrote code to easily switch
<lisael>
a common abstraction is exactly what I need here.