Skip to content

refactor/query#12

Open
decanus wants to merge 12 commits intomasterfrom
refactor/query
Open

refactor/query#12
decanus wants to merge 12 commits intomasterfrom
refactor/query

Conversation

@decanus
Copy link
Contributor

@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
Contributor 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
Contributor 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.

2 participants