-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1283 from akoshelev/hybrid-query-type
Hybrid and sharded suffle query types
- Loading branch information
Showing
7 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq)] | ||
#[cfg_attr(feature = "clap", derive(clap::Args))] | ||
pub struct HybridQueryParams { | ||
#[cfg_attr(feature = "clap", arg(long, default_value = "8"))] | ||
pub per_user_credit_cap: u32, | ||
#[cfg_attr(feature = "clap", arg(long, default_value = "5"))] | ||
pub max_breakdown_key: u32, | ||
#[cfg_attr(feature = "clap", arg(short = 'd', long, default_value = "1"))] | ||
pub with_dp: u32, | ||
#[cfg_attr(feature = "clap", arg(short = 'e', long, default_value = "5.0"))] | ||
pub epsilon: f64, | ||
#[cfg_attr(feature = "clap", arg(long))] | ||
#[serde(default)] | ||
pub plaintext_match_keys: bool, | ||
} | ||
|
||
#[cfg(test)] | ||
impl Eq for HybridQueryParams {} | ||
|
||
impl Default for HybridQueryParams { | ||
fn default() -> Self { | ||
Self { | ||
per_user_credit_cap: 8, | ||
max_breakdown_key: 20, | ||
with_dp: 1, | ||
epsilon: 0.10, | ||
plaintext_match_keys: false, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::{marker::PhantomData, sync::Arc}; | ||
|
||
use crate::{ | ||
error::Error, | ||
helpers::{ | ||
query::{HybridQueryParams, QuerySize}, | ||
BodyStream, | ||
}, | ||
hpke::PrivateKeyRegistry, | ||
secret_sharing::{replicated::semi_honest::AdditiveShare as ReplicatedShare, SharedValue}, | ||
}; | ||
|
||
pub struct Query<C, HV, R: PrivateKeyRegistry> { | ||
_config: HybridQueryParams, | ||
_key_registry: Arc<R>, | ||
phantom_data: PhantomData<(C, HV)>, | ||
} | ||
|
||
impl<C, HV: SharedValue, R: PrivateKeyRegistry> Query<C, HV, R> { | ||
pub fn new(query_params: HybridQueryParams, key_registry: Arc<R>) -> Self { | ||
Self { | ||
_config: query_params, | ||
_key_registry: key_registry, | ||
phantom_data: PhantomData, | ||
} | ||
} | ||
|
||
#[tracing::instrument("hybrid_query", skip_all, fields(sz=%query_size))] | ||
pub async fn execute( | ||
self, | ||
_ctx: C, | ||
query_size: QuerySize, | ||
_input_stream: BodyStream, | ||
) -> Result<Vec<ReplicatedShare<HV>>, Error> { | ||
unimplemented!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters