LevelDB support in Dart

270 views
Skip to first unread message

Jon Brisbin

unread,
Sep 25, 2014, 12:30:17 PM9/25/14
to mi...@dartlang.org
I couldn't find anything extant to use LevelDB from Dart and a quick answer on StackOverflow confirmed my suspicions: there is no LevelDB support from Dart. That's odd considering they're both Google initiatives--but I can understand that priorities are somewhat different. IMO good LevelDB support would be a huge win for server-side Dart. I'm not a C++ programmer myself, so I wouldn't trust the code I would attempt to write to create an async port that uses LevelDB's C++ API. I'm sure I could muddle through but I'm just not sure I have the time or willpower. 

Since I can't find any other questions about LevelDB here in this group, I assume no one has yet discussed what form this integration should take and what such a Dart API would look like?

Justin Fagnani

unread,
Sep 25, 2014, 3:19:05 PM9/25/14
to General Dart Discussion
On Thu, Sep 25, 2014 at 9:30 AM, Jon Brisbin <j...@jbrisbin.com> wrote:
I couldn't find anything extant to use LevelDB from Dart and a quick answer on StackOverflow confirmed my suspicions: there is no LevelDB support from Dart. That's odd considering they're both Google initiatives

It's not really that odd. They're a different team, and it's not like every team at Google rushes out and creates clients in Go and Dart immediately just because they're Google created languages. There's gradual uptake that happens inside Google, just like there is outside of it, so it takes time for someone to come around to needing something like this, especially since we're really just getting started with server-side Dart.
 
--but I can understand that priorities are somewhat different. IMO good LevelDB support would be a huge win for server-side Dart. I'm not a C++ programmer myself, so I wouldn't trust the code I would attempt to write to create an async port that uses LevelDB's C++ API. I'm sure I could muddle through but I'm just not sure I have the time or willpower. 

Is there a LevelDB group you could maybe get help from?
 

Since I can't find any other questions about LevelDB here in this group, I assume no one has yet discussed what form this integration should take and what such a Dart API would look like?

Not that I know of. I assume it'd look something like IndexedDB or the other database packages - the good ones have used Futures and Streams to make idiomatic APIs. I see that the LevelUP package for Node is synchronous, I'd probably suggest that a Dart API be asynchronous.

Cheers,
  Justin

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Jon Brisbin

unread,
Sep 25, 2014, 3:25:30 PM9/25/14
to mi...@dartlang.org

On September 25, 2014 at 2:19:04 PM, 'Justin Fagnani' via Dart Misc (mi...@dartlang.org) wrote:

 
--but I can understand that priorities are somewhat different. IMO good LevelDB support would be a huge win for server-side Dart. I'm not a C++ programmer myself, so I wouldn't trust the code I would attempt to write to create an async port that uses LevelDB's C++ API. I'm sure I could muddle through but I'm just not sure I have the time or willpower. 

Is there a LevelDB group you could maybe get help from?


I’m not currently part of one but I’m sure there’s help to be had there…


 

Since I can't find any other questions about LevelDB here in this group, I assume no one has yet discussed what form this integration should take and what such a Dart API would look like?

Not that I know of. I assume it'd look something like IndexedDB or the other database packages - the good ones have used Futures and Streams to make idiomatic APIs. I see that the LevelUP package for Node is synchronous, I'd probably suggest that a Dart API be asynchronous.


I agree. I’m all about reactive, async patterns! :)

I’ve been looking into the async port API for Dart and it does look reasonably straightforward. The hard part is really going to be getting the C part correct since that’s a bit of an unknown to me.


Thanks!

Jon Brisbin
@JonBrisbin | @mformonochrome

George Moschovitis

unread,
Sep 26, 2014, 8:39:00 AM9/26/14
to
I couldn't find anything extant to use LevelDB from Dart

I could also find good uses for such a package, but I also have no time/willpower to write a native extension :(

Daniel Morilha

unread,
Sep 28, 2014, 1:25:35 PM9/28/14
to mi...@dartlang.org
I've been playing with the bindings this weekend. There is still a lot to be done. Feel free to fork and contribute.

Thanks,


On Fri, Sep 26, 2014 at 5:39 AM, George Moschovitis <george.mo...@gmail.com> wrote:
I couldn't find anything extant to use LevelDB from Dart

I could also find good uses for such a packages, but I also have no time/willpower to write a native extension :(

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.



--
Daniel Morilha (dmor...@gmail.com)

John Hewson

unread,
Oct 1, 2014, 3:02:04 AM10/1/14
to mi...@dartlang.org
dmorilha, looks like a good start. One thought: to be usable in a Dart web server the bindings will need to be asynchronous.

-- John

Filipe Morgado

unread,
Oct 1, 2014, 6:00:54 AM10/1/14
to mi...@dartlang.org
Hey guys,

I would definitely consider such a library.

I have nothing helpful to add except for a suggestion.

Maybe use RocksDB instead?
It originally forked from LevelDB, improved a lot of stuff (way better concurrency, fast storage optimizations, etc) and is actively developed.

LevelDB seems pretty stall.

Jon Brisbin

unread,
Oct 1, 2014, 9:56:31 AM10/1/14
to mi...@dartlang.org
RocksDB looks very intriguing!

I really wish I was a C++ programmer because I would love to dig into creating a Dart Stream-based API around this kind of high-performance K/V store. The RocksDB API actually does look easier to grok than LevelDB. It would be a good choice for an async and Stream-based package.


Thanks!

Jon Brisbin
@JonBrisbin | @mformonochrome


Adam Lofts

unread,
Jan 19, 2016, 5:00:22 AM1/19/16
to Dart Misc, j...@jbrisbin.com
I have written a LevelDB binding for the Dart VM. It is fully async and uses a Stream for iterating over key/value pairs in the database so you can use an await for loop.

The api is modelled on the Node.js bindings (LevelUP) which are mature so I don't expect huge changes.


I am unable to upload it to pub because I don't think pub supports dart native extensions.

Adam
Reply all
Reply to author
Forward
0 new messages