Skip to content
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

[rust] --gen-mutable support in rust timeline ? #5772

Closed
sundeepks opened this issue Feb 18, 2020 · 9 comments
Closed

[rust] --gen-mutable support in rust timeline ? #5772

sundeepks opened this issue Feb 18, 2020 · 9 comments
Labels

Comments

@sundeepks
Copy link

Do we have API to in place mutation in rust ? currently using flatc (/snap/flatbuffers/191/bin/flatc) when I am generating code with --gen-mutable flag I do'n't see any generated code difference.

Wanted to perform in place mutation (Scalar values incremental updates) of bytes (stored in disk) & again persisting to disk

Any pointers on how to achieve the same using rust ?

@sundeepks sundeepks changed the title [rust] --gen-mutable supported in rust [rust] --gen-mutable support in rust timeline ? Mar 5, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2020

This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Sep 3, 2020
@mleonhard
Copy link

I just discovered flatbuffers. Does this mean that flatc produces Rust code that cannot mutate flatbuffers?

@mleonhard
Copy link

Answering my own question:
"FlatBuffers supports both reading and writing FlatBuffers in Rust."
https://google.github.io/flatbuffers/flatbuffers_guide_use_rust.html

@github-actions github-actions bot removed the stale label Sep 14, 2020
@kalyanmysore
Copy link

@mleonhard gen-mutable refers to a different concept.
Rust does allow you to create a flat buffer (i.e, serialize items to a block of bytes) and also allows you to read items out of such a serialized block of bytes.
However, the c++ implementation allows an ability to change (mutate) a scalar value in such a serialized block of bytes very efficiently. This feature allows very efficient programs that dont have to have (or have less of) other data structures (and memory access) to store dynamic state.
The issue is that rust does not yet support this (atleast, as far as I know). c++ supports it via the --gen-mutable compiler option.

@CasperN
Copy link
Collaborator

CasperN commented Oct 6, 2020

Rust support for in-place mutation is somewhat far away.

Current priorities are:

  1. Better representation of enums
  2. Verifier
  3. Better story around untrusted data in general
  4. object API
  5. Mutation API

@CasperN CasperN closed this as completed Oct 6, 2020
@ec1oud
Copy link

ec1oud commented Nov 12, 2022

Why do you close it if it's "somewhat far away" but not impossible? I was also hoping to use that feature. Is C++ really the only language that has it?

@Buggaboo
Copy link

Do we have API to in place mutation in rust ? currently using flatc (/snap/flatbuffers/191/bin/flatc) when I am generating code with --gen-mutable flag I do'n't see any generated code difference.

Wanted to perform in place mutation (Scalar values incremental updates) of bytes (stored in disk) & again persisting to disk

Any pointers on how to achieve the same using rust ?

If you want memory stored on disk that reflects some kind of thread-safe memory pool (bar unbounded Vectors), you could look into mmap. In case of any mutations, e.g. a mutating worker thread, could use channels to pass on messages to any async receiver, to start reading the mutated data. Afaik, Builder and Table etc. don't care where they get their slice from.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jul 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2023

This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants