-
Notifications
You must be signed in to change notification settings - Fork 3
protocol-determined vdaf representation #419
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3b702a3
protocol-determined vdaf representation
jbr 22d230d
remove protocol from task
jbr 2578460
fix clap histogram length arg configuration
jbr eee0d37
Update src/entity/task/vdaf.rs
jbr d6be226
fix test to represent [1,2,3] having length 4 in DAP-05
jbr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
| use serde::{Deserialize, Serialize}; | ||
| use std::{ | ||
| error::Error, | ||
| fmt::{self, Display, Formatter}, | ||
| str::FromStr, | ||
| }; | ||
|
|
||
| #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] | ||
| pub enum Protocol { | ||
| #[serde(rename = "DAP-04")] | ||
| Dap04, | ||
| #[serde(rename = "DAP-05")] | ||
| Dap05, | ||
| } | ||
|
|
||
| impl AsRef<str> for Protocol { | ||
| fn as_ref(&self) -> &str { | ||
| match self { | ||
| Self::Dap04 => "DAP-04", | ||
| Self::Dap05 => "DAP-05", | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct UnrecognizedProtocol(String); | ||
| impl Display for UnrecognizedProtocol { | ||
| fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { | ||
| f.write_fmt(format_args!("{} was not a recognized protocol", self.0)) | ||
| } | ||
| } | ||
| impl Error for UnrecognizedProtocol {} | ||
| impl FromStr for Protocol { | ||
| type Err = UnrecognizedProtocol; | ||
| fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
| match &*s.to_lowercase() { | ||
| "dap-04" => Ok(Self::Dap04), | ||
| "dap-05" => Ok(Self::Dap05), | ||
| unrecognized => Err(UnrecognizedProtocol(unrecognized.to_string())), | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
52 changes: 52 additions & 0 deletions
52
migration/src/m20230817_192017_add_protocol_to_aggregators.rs
This file contains hidden or 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,52 @@ | ||
| use sea_orm_migration::prelude::*; | ||
|
|
||
| #[derive(DeriveMigrationName)] | ||
| pub struct Migration; | ||
|
|
||
| #[async_trait::async_trait] | ||
| impl MigrationTrait for Migration { | ||
| async fn up(&self, db: &SchemaManager) -> Result<(), DbErr> { | ||
| db.alter_table( | ||
| TableAlterStatement::new() | ||
| .table(Aggregator::Table) | ||
| .add_column(ColumnDef::new(Aggregator::Protocol).string().null()) | ||
| .to_owned(), | ||
| ) | ||
| .await?; | ||
|
|
||
| db.exec_stmt( | ||
| Query::update() | ||
| .table(Aggregator::Table) | ||
| .value(Aggregator::Protocol, "DAP-04") | ||
| .to_owned(), | ||
| ) | ||
| .await?; | ||
|
|
||
| db.alter_table( | ||
| TableAlterStatement::new() | ||
| .table(Aggregator::Table) | ||
| .modify_column(ColumnDef::new(Aggregator::Protocol).not_null()) | ||
| .to_owned(), | ||
| ) | ||
| .await?; | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| async fn down(&self, db: &SchemaManager) -> Result<(), DbErr> { | ||
| db.alter_table( | ||
| TableAlterStatement::new() | ||
| .table(Aggregator::Table) | ||
| .drop_column(Aggregator::Protocol) | ||
| .to_owned(), | ||
| ) | ||
| .await?; | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| #[derive(DeriveIden)] | ||
| enum Aggregator { | ||
| Table, | ||
| Protocol, | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.