-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Repo Creation [Objectbox-Rust] #41
Comments
Once someone can provide some minimal useful code, we're open to create a new repo. |
I may be wrong, but the OP's comment seems to be a request for your organization to provide a Rust client implementation. I'm not entirely sure. I do have a hard time believing that they're insisting you rewrite your service(s) in Rust. This issue is very vague. @swise0: are you volunteering to do the work or are you asking someone else to? wrt the project and the organization behind it, it all looks pretty interesting. If your organization takes the initiative to get things started, I would consider contributing. It's still not clear exactly what this ticket is asking for. |
Asking someone to 😅 |
For clarification: the scope would be similar to this repo (objectbox-go), but for Rust. It would offer a Rust API (aka "frontend", "binding") on top of the core ObjectBox library (which exposes a C API). Thus, it's not a client in the client/server sense. It still would be an embedded database. At some point @vaind experimented with ObjectBox and Rust; https://github.com/vaind/objectbox-rust is likely worth a look... |
That was just very early development and I don't think much is in there, but feel free to use whatever you like. |
I worked on the macro attributes part, aka annotations on struct fields. use objectbox;
extern crate builder;
use builder::{entity, index, transient, unique};
#[entity]
struct CorrectType {
t_bool : bool,
#[unique(uid=1339)]
t_u32 : u32,
}
#[entity(uid=1337)]
struct LessEmptyTypeWithParams {
#[index(uid=1338)]
t_bool : bool,
#[transient]
t_u32 : u32,
t_u64 : u64,
t_double : f64,
} I saw there was a model generator in C++. Maybe we can reuse some of that code, Generating JSON is the easy part, feeding that Feel free to fork this and continue fleshing this out. |
The generator @Buggaboo mentions is: https://github.com/objectbox/objectbox-generator#getting-started and currently generates C/C++ and Go, and yes, it is prepared to be extended to generate more languages. |
Hi, I got a minimally working work-in-progress version, many thanks to @vaind, please check out the I have some support for the Drop trait (read: auto memory clean up), but I haven't verified that yet with valgrind, especially in error cases. I tried to preserve the zero-copy design, by passing around slices like hot pizza. I can't claim that it's very rusty, e.g. devoid of footguns etc., but I'm open to suggestions to make it so. It needs a lot of polishing (a lot of dead comments and code), and there is no support for async, channels, threads or Pull requests are welcome. @greenrobot-team Please evaluate if this is worthy of starting a repo on your side, at this stage. It's completely untested on any ARCH other than my intel chip, on my old x86_64. As a freelancer, I wouldn't mind maintaining this as a paid gig. |
Minor update:
Question @greenrobot-team: which pointers that are exposed from the ffi interface, to build a query, should be free'd from Rust's side? Or should these be transmuted after use, for the C code to free? |
@Buggaboo Thanks for your efforts! I think at this time we don't have any resources to support this directly, but we'll discuss this internally! If @greenrobot has time he can maybe answer questions, my knowledge in C/Rust is very limited. |
I found the culprit for the double-free. I have to run an init function, like java's |
Enable rustlang support or integration.. since Rust is more focused on performance and memory safety
The text was updated successfully, but these errors were encountered: