ejdb icon indicating copy to clipboard operation
ejdb copied to clipboard

EJDB2 Rust binding

Open adamansky opened this issue 6 years ago • 6 comments
trafficstars

adamansky avatar Apr 04 '19 08:04 adamansky

Are you need a help with it?

katyo avatar Oct 02 '19 17:10 katyo

Sure! Some work was done by one of our contributor https://gitlab.com/bemyak/ejdb2-rs But we are still finding good ways to start. So any contributions are appreciated, especially for Rust, since it has quite high learning curve for me to start write good code in few days from scratch.

adamansky avatar Oct 03 '19 15:10 adamansky

here is the rust binding I created,

https://crates.io/crates/ejdb2

it is mostly working (the current missing function is the http server). Sorry I didn't know about the above project before starting. but I just checked, it appears to be empty other that the lower-level binding?

I'm also interested in making one for python.

I'm not happy about the exec function in my implementation. initially I wanted it to be like C which accepts a callback as input. But I ran into issues when passing a rust lambda to the ejdb callback. It crashes.

My current version takes a vector as the input instead. The vector will be filled with results. I know other bindings implement a document stream or a cursor / iterator. I can do that too. I'm thinking of running exec in a separate thread and immediately returns an iterator to the caller. The iterator and the exec form a consumer-producer. But I don't know the benefit of this vs. my current naive implementation as the producer-consumer will likely introduce extra data copies.

I also find it inconvenient that EJDB doesn't support operators on the primary key other than '=', for example /* > 32 is invalid. This is a common way for implementing fast pagination with mongodb (https://www.codementor.io/@arpitbhayani/fast-and-efficient-pagination-in-mongodb-9095flbqr), not sure if this optimization makes sense for EJDB though .

shi-yan avatar Oct 12 '21 01:10 shi-yan

Thank you so much! I will respond to your comment and set ref to your bind in few days

adamansky avatar Oct 12 '21 16:10 adamansky

@adamansky What is the status of this issue?

whizsid avatar Feb 14 '22 00:02 whizsid

I'm sorry for the long delay (= I've listed this binding in the project README.

I also find it inconvenient that EJDB doesn't support operators on the primary key other than '=', for example /* > 32 is invalid. I think it is quite easy to implement will try to do it next month.

adamansky avatar Feb 24 '22 02:02 adamansky