Skip to content

Commit

Permalink
remove protocol from task
Browse files Browse the repository at this point in the history
  • Loading branch information
jbr committed Aug 24, 2023
1 parent 3b702a3 commit 22d230d
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 51 deletions.
2 changes: 0 additions & 2 deletions client/src/task.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::Protocol;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use uuid::Uuid;
Expand All @@ -23,7 +22,6 @@ pub struct Task {
pub leader_aggregator_id: Uuid,
pub helper_aggregator_id: Uuid,
pub hpke_config_id: Uuid,
pub protocol: Protocol,
}

#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod m20230703_201332_add_additional_fields_to_api_tokens;
mod m20230725_220134_add_vdafs_and_query_types_to_aggregators;
mod m20230731_181722_rename_aggregator_bearer_token;
mod m20230808_204859_create_hpke_config;
mod m20230817_192017_add_dap_versions_to_tasks_and_aggregators;
mod m20230817_192017_add_protocol_to_aggregators;

pub struct Migrator;

Expand All @@ -42,7 +42,7 @@ impl MigratorTrait for Migrator {
Box::new(m20230725_220134_add_vdafs_and_query_types_to_aggregators::Migration),
Box::new(m20230731_181722_rename_aggregator_bearer_token::Migration),
Box::new(m20230808_204859_create_hpke_config::Migration),
Box::new(m20230817_192017_add_dap_versions_to_tasks_and_aggregators::Migration),
Box::new(m20230817_192017_add_protocol_to_aggregators::Migration),
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,6 @@ impl MigrationTrait for Migration {
)
.await?;

db.alter_table(
TableAlterStatement::new()
.table(Task::Table)
.add_column(ColumnDef::new(Task::Protocol).string().null())
.to_owned(),
)
.await?;

db.exec_stmt(
Query::update()
.table(Task::Table)
.value(Task::Protocol, "DAP-04")
.to_owned(),
)
.await?;

db.alter_table(
TableAlterStatement::new()
.table(Task::Table)
.modify_column(ColumnDef::new(Task::Protocol).not_null())
.to_owned(),
)
.await?;

Ok(())
}

Expand All @@ -65,13 +41,6 @@ impl MigrationTrait for Migration {
.to_owned(),
)
.await?;
db.alter_table(
TableAlterStatement::new()
.table(Task::Table)
.drop_column(Task::Protocol)
.to_owned(),
)
.await?;
Ok(())
}
}
Expand All @@ -81,9 +50,3 @@ enum Aggregator {
Table,
Protocol,
}

#[derive(DeriveIden)]
enum Task {
Table,
Protocol,
}
4 changes: 1 addition & 3 deletions src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ mod codec;
pub mod hpke_config;
mod json;
pub mod membership;
pub mod protocol;
pub mod queue;
pub mod session;
pub mod task;
Expand All @@ -17,7 +16,7 @@ pub use account::{
};
pub use aggregator::{
Column as AggregatorColumn, Entity as Aggregators, Model as Aggregator, NewAggregator,
UpdateAggregator,
Protocol, Role, UnrecognizedProtocol, UnrecognizedRole, UpdateAggregator,
};
pub use api_token::{
Column as ApiTokenColumn, Entity as ApiTokens, Model as ApiToken, UpdateApiToken,
Expand All @@ -29,7 +28,6 @@ pub use hpke_config::{
pub use membership::{
Column as MembershipColumn, CreateMembership, Entity as Memberships, Model as Membership,
};
pub use protocol::{Protocol, UnrecognizedProtocol};
pub use session::{Column as SessionColumn, Entity as Sessions, Model as Session};
pub use task::{
Column as TaskColumn, Entity as Tasks, Model as Task, NewTask, ProvisionableTask, UpdateTask,
Expand Down
3 changes: 2 additions & 1 deletion src/entity/aggregator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod new_aggregator;
mod protocol;
mod query_type_name;
mod role;
mod update_aggregator;
Expand All @@ -15,8 +16,8 @@ use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use uuid::Uuid;

pub use super::protocol::{Protocol, UnrecognizedProtocol};
pub use new_aggregator::NewAggregator;
pub use protocol::{Protocol, UnrecognizedProtocol};
pub use query_type_name::{QueryTypeName, QueryTypeNameSet};
pub use role::{Role, UnrecognizedRole};
pub use update_aggregator::UpdateAggregator;
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions src/entity/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub use new_task::NewTask;
mod update_task;
pub use update_task::UpdateTask;
mod provisionable_task;
use super::Protocol;
pub use provisionable_task::{ProvisionableTask, TaskProvisioningError};

use super::json::Json;
Expand All @@ -49,7 +48,6 @@ pub struct Model {
pub leader_aggregator_id: Uuid,
pub helper_aggregator_id: Uuid,
pub hpke_config_id: Uuid,
pub protocol: Protocol,
}

impl Model {
Expand Down
4 changes: 3 additions & 1 deletion src/entity/task/new_task.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use super::*;
use crate::{
clients::aggregator_client::api_types::{AggregatorVdaf, QueryType},
entity::{aggregator::Role, Account, Aggregator, Aggregators, HpkeConfig, HpkeConfigColumn},
entity::{
aggregator::Role, Account, Aggregator, Aggregators, HpkeConfig, HpkeConfigColumn, Protocol,
},
handler::Error,
};
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
Expand Down
3 changes: 1 addition & 2 deletions src/entity/task/provisionable_task.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{ActiveModel, *};
use crate::{
clients::aggregator_client::api_types::{AggregatorVdaf, AuthenticationToken},
entity::{Account, Aggregator, HpkeConfig, Task},
entity::{Account, Aggregator, HpkeConfig, Protocol, Task},
handler::Error,
Crypter,
};
Expand Down Expand Up @@ -117,7 +117,6 @@ impl ProvisionableTask {
leader_aggregator_id: self.leader_aggregator.id,
helper_aggregator_id: self.helper_aggregator.id,
hpke_config_id: self.hpke_config.id,
protocol: self.protocol,
}
.into_active_model())
}
Expand Down
1 change: 0 additions & 1 deletion test-support/src/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ pub async fn task(app: &DivviupApi, account: &Account) -> Task {
leader_aggregator_id: leader_aggregator.id,
helper_aggregator_id: helper_aggregator.id,
hpke_config_id: hpke_config.id,
protocol: Protocol::Dap05,
}
.into_active_model()
.insert(app.db())
Expand Down

0 comments on commit 22d230d

Please sign in to comment.