Skip to content

refactor/query - #12

Open
decanus wants to merge 12 commits into
masterfrom
refactor/query
Open

refactor/query#12
decanus wants to merge 12 commits into
masterfrom
refactor/query

Conversation

@decanus

@decanus decanus commented Apr 12, 2020

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread sinkhole-query/src/lib.rs
/// This struct represents PIR queries.
pub struct Query {
/// The encoded field queries.
fields: [Vec<u8>],

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

decanus commented Apr 22, 2020

Copy link
Copy Markdown
Contributor Author

@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