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

Reconsider representation for flags #35

Closed
blaesus opened this issue Apr 4, 2019 · 2 comments
Closed

Reconsider representation for flags #35

blaesus opened this issue Apr 4, 2019 · 2 comments
Assignees
Milestone

Comments

@blaesus
Copy link
Contributor

blaesus commented Apr 4, 2019

For bitvec in Mongo ops (such as response_flags in OP_REPLY, using them as i32/u32 is cumbersome and error-prone (one needs to use bit manipulation to extract information).

Rust provides BitVec.

Alternatively, we might as well just parse the initial bytes as struct { fieldA: bool, fieldB: bool } and only handle bitvec logic in seralizer and parser.

cc @poppindouble

@blaesus blaesus added this to the April 2019 milestone Apr 4, 2019
@blaesus blaesus self-assigned this Apr 4, 2019
@blaesus blaesus added this to Mongo in Implementation Apr 4, 2019
@poppindouble
Copy link
Collaborator

poppindouble commented Apr 4, 2019

I do agree with you, the i32/u32 representation is not a good option, since this field is not representing a i32/u32 number, Bit 0, 1, 16 have their own meaning,

However the BitVec has been removed from standard collections, you can check the PR here. The link above might not be what we want.

I also checked other two crate which allows you interact with bit more easily in Rust:

  1. https://crates.io/crates/bit-vec
  2. https://crates.io/crates/bitvec

Those two crates might not be trustable, they either don't have enough maintain resources or they don't have a strong evidence it is a trustable crates.

@blaesus
Copy link
Contributor Author

blaesus commented Apr 15, 2019

Superseded by #51

@blaesus blaesus closed this as completed Apr 15, 2019
@blaesus blaesus removed this from Mongo in Implementation Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants