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

refactor/query #12

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

refactor/query #12

wants to merge 12 commits into from

Conversation

decanus
Copy link
Member

@decanus decanus commented Apr 12, 2020

No description provided.

/// This struct represents PIR queries.
pub struct Query {
/// The encoded field queries.
fields: [Vec<u8>],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Alternatively, we can have a Vec<Vec<u8>>, but not a big deal since the query is meant to be serialized and passed along to the server.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did [] because we don't want the array to be tampered with. Is my thinking here wrong?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fields will be non-mutable by definition (Rust things :) ) if that's what you mean. In order to change the values of a struct field, you'd need to wrap it in a Box or RefCell - similar to what we have in the Storage:

 struct Storage {                                                                        
  secret_key: SecretKey,                                                              
  size: usize,                                                                        
  store: RefCell<Vec<Scalar>>,                                                        
}    

If store was defined as store: Vec<Scalar>,, the contents of the vector could not be changed.

@decanus
Copy link
Member Author

decanus commented Apr 22, 2020

@gpestana once your PR is merged, I will adapt this to look more like what you are doing.

@decanus decanus marked this pull request as ready for review May 7, 2020 16:53
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

Successfully merging this pull request may close these issues.

None yet

2 participants