Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jimouris committed Oct 28, 2023
1 parent 1367738 commit 13d571f
Show file tree
Hide file tree
Showing 35 changed files with 1,350 additions and 1,197 deletions.
8 changes: 4 additions & 4 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ hex = "0.3.0"
serde = {version = "1.0.104", features = ["derive"] }
num = "0.2.1"
wasm-timer = "0.2.5"
aws-config = "0.54.1"
aws-credential-types = "0.54.1"
aws-sdk-s3 = "0.24.0"
aws-smithy-http = "0.54.0"
aws-config = "0.56.1"
aws-credential-types = "0.56.1"
aws-sdk-s3 = "0.34.0"
aws-smithy-http = "0.56.0"
lazy_static = "1.4.0"
regex = "1.5.4"
tempfile = "3.2.0"
Expand Down
7 changes: 5 additions & 2 deletions common/datagen/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,17 @@ fn main() {

let fn_a = format!("{}/input_{}_size_{}_cols_{}.csv", dir, "a", size, cols);
let fn_b = format!("{}/input_{}_size_{}_cols_{}.csv", dir, "b", size, cols);
let fn_b_features = format!("{}/input_{}_size_{}_cols_{}_features.csv", dir, "b", size, cols);
let fn_b_features = format!(
"{}/input_{}_size_{}_cols_{}_features.csv",
dir, "b", size, cols
);

info!("Generating output of size {}", size);
info!("Player a output: {}", fn_a);
info!("Player b output: {}", fn_b);
info!("Player b features: {}", fn_b_features);

let intrsct = size / 2 as usize;
let intrsct = size / 2_usize;
let size_player = size - intrsct;
let data = gen::random_data(size_player, size_player, intrsct);
info!("Data generation done, writing to files");
Expand Down
4 changes: 3 additions & 1 deletion common/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ where
it.map(|x| {
x.unwrap()
.iter()
.map(|z| u64::from_str(z.trim()).unwrap_or_else(|_| panic!("Cannot format {} as u64", z)))
.map(|z| {
u64::from_str(z.trim()).unwrap_or_else(|_| panic!("Cannot format {} as u64", z))
})
.collect::<Vec<u64>>()
})
.collect::<Vec<Vec<u64>>>()
Expand Down
19 changes: 7 additions & 12 deletions common/src/s3_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ use std::path::Path;
use std::str::FromStr;
use std::time::Duration;

use aws_sdk_s3::Region;
use aws_sdk_s3::error::NoSuchUpload;
use aws_sdk_s3::model::CompletedPart;
use aws_sdk_s3::model::CompletedMultipartUpload;
use aws_sdk_s3::types::ByteStream;
use aws_config::default_provider::credentials::default_provider;
use aws_credential_types::cache::CredentialsCache;
use regex::Regex;
Expand Down Expand Up @@ -54,7 +49,7 @@ impl S3Path {

pub async fn copy_to_local(&self) -> Result<String, std::io::Error> {
let default_provider = default_provider().await;
let region = Region::new(self.get_region().clone());
let region = aws_sdk_s3::config::Region::new(self.get_region().clone());
let aws_cfg = aws_config::from_env()
.credentials_cache(
CredentialsCache::lazy_builder()
Expand Down Expand Up @@ -101,7 +96,7 @@ impl S3Path {

pub async fn copy_from_local(&self, path: impl AsRef<Path>) -> Result<(), aws_sdk_s3::Error> {
let default_provider = default_provider().await;
let region = Region::new(self.get_region().clone());
let region = aws_sdk_s3::config::Region::new(self.get_region().clone());
let aws_cfg = aws_config::from_env()
.region(region)
.credentials_cache(
Expand Down Expand Up @@ -136,12 +131,12 @@ impl S3Path {
.unwrap();
let uid = u.upload_id().ok_or_else(|| {
aws_sdk_s3::Error::NoSuchUpload(
NoSuchUpload::builder()
aws_sdk_s3::types::error::NoSuchUpload::builder()
.message("No upload ID")
.build(),
)
})?;
let mut completed_parts: Vec<CompletedPart> = Vec::new();
let mut completed_parts: Vec<aws_sdk_s3::types::CompletedPart> = Vec::new();
for i in 0..chunks {
let length = if i == chunks - 1 {
// If we're on the last chunk, the length to read might be less than a whole chunk.
Expand All @@ -151,7 +146,7 @@ impl S3Path {
} else {
chunk_size
};
let byte_stream = ByteStream::read_from()
let byte_stream = aws_sdk_s3::primitives::ByteStream::read_from()
.path(path.as_ref())
.offset(i * chunk_size)
.length(aws_smithy_http::byte_stream::Length::Exact(length))
Expand All @@ -167,14 +162,14 @@ impl S3Path {
.send()
.await
.unwrap();
let cp = CompletedPart::builder()
let cp = aws_sdk_s3::types::CompletedPart::builder()
.set_e_tag(upload.e_tag)
.part_number((i + 1) as i32)
.build();
completed_parts.push(cp);
}
// Complete multipart upload, sending the (etag, part id) list along the request.
let b = CompletedMultipartUpload::builder()
let b = aws_sdk_s3::types::CompletedMultipartUpload::builder()
.set_parts(Some(completed_parts))
.build();
let completed = client
Expand Down
40 changes: 12 additions & 28 deletions protocol-rpc/src/connect/create_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ use tonic::transport::Endpoint;
use crate::connect::tls;
use crate::proto::gen_crosspsi::cross_psi_client::CrossPsiClient;
use crate::proto::gen_crosspsi_xor::cross_psi_xor_client::CrossPsiXorClient;
use crate::proto::gen_pjc::pjc_client::PjcClient;
use crate::proto::gen_private_id::private_id_client::PrivateIdClient;
use crate::proto::gen_private_id_multi_key::private_id_multi_key_client::PrivateIdMultiKeyClient;
use crate::proto::gen_suid_create::suid_create_client::SuidCreateClient;
use crate::proto::gen_dpmc_company::dpmc_company_client::DpmcCompanyClient;
use crate::proto::gen_dpmc_partner::dpmc_partner_client::DpmcPartnerClient;
use crate::proto::gen_dspmc_company::dspmc_company_client::DspmcCompanyClient;
use crate::proto::gen_dspmc_helper::dspmc_helper_client::DspmcHelperClient;
use crate::proto::gen_dspmc_partner::dspmc_partner_client::DspmcPartnerClient;
use crate::proto::gen_pjc::pjc_client::PjcClient;
use crate::proto::gen_private_id::private_id_client::PrivateIdClient;
use crate::proto::gen_private_id_multi_key::private_id_multi_key_client::PrivateIdMultiKeyClient;
use crate::proto::gen_suid_create::suid_create_client::SuidCreateClient;
use crate::proto::RpcClient;

pub fn create_client(
Expand Down Expand Up @@ -145,21 +145,11 @@ pub fn create_client(
"cross-psi-xor" => RpcClient::CrossPsiXor(CrossPsiXorClient::new(conn)),
"pjc" => RpcClient::Pjc(PjcClient::new(conn)),
"suid-create" => RpcClient::SuidCreate(SuidCreateClient::new(conn)),
"dpmc-company" => RpcClient::DpmcCompany(
DpmcCompanyClient::new(conn),
),
"dpmc-partner" => RpcClient::DpmcPartner(
DpmcPartnerClient::new(conn),
),
"dspmc-company" => RpcClient::DspmcCompany(
DspmcCompanyClient::new(conn),
),
"dspmc-helper" => RpcClient::DspmcHelper(
DspmcHelperClient::new(conn),
),
"dspmc-partner" => RpcClient::DspmcPartner(
DspmcPartnerClient::new(conn),
),
"dpmc-company" => RpcClient::DpmcCompany(DpmcCompanyClient::new(conn)),
"dpmc-partner" => RpcClient::DpmcPartner(DpmcPartnerClient::new(conn)),
"dspmc-company" => RpcClient::DspmcCompany(DspmcCompanyClient::new(conn)),
"dspmc-helper" => RpcClient::DspmcHelper(DspmcHelperClient::new(conn)),
"dspmc-partner" => RpcClient::DspmcPartner(DspmcPartnerClient::new(conn)),
_ => panic!("wrong client"),
})
} else {
Expand Down Expand Up @@ -187,19 +177,13 @@ pub fn create_client(
DpmcPartnerClient::connect(__uri).await.unwrap(),
)),
"dspmc-company" => Ok(RpcClient::DspmcCompany(
DspmcCompanyClient::connect(__uri)
.await
.unwrap(),
DspmcCompanyClient::connect(__uri).await.unwrap(),
)),
"dspmc-helper" => Ok(RpcClient::DspmcHelper(
DspmcHelperClient::connect(__uri)
.await
.unwrap(),
DspmcHelperClient::connect(__uri).await.unwrap(),
)),
"dspmc-partner" => Ok(RpcClient::DspmcPartner(
DspmcPartnerClient::connect(__uri)
.await
.unwrap(),
DspmcPartnerClient::connect(__uri).await.unwrap(),
)),
_ => panic!("wrong client"),
}
Expand Down
8 changes: 4 additions & 4 deletions protocol-rpc/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ pub mod streaming;

use gen_crosspsi::cross_psi_client::CrossPsiClient;
use gen_crosspsi_xor::cross_psi_xor_client::CrossPsiXorClient;
use gen_pjc::pjc_client::PjcClient;
use gen_private_id::private_id_client::PrivateIdClient;
use gen_private_id_multi_key::private_id_multi_key_client::PrivateIdMultiKeyClient;
use gen_suid_create::suid_create_client::SuidCreateClient;
use gen_dpmc_company::dpmc_company_client::DpmcCompanyClient;
use gen_dpmc_partner::dpmc_partner_client::DpmcPartnerClient;
use gen_dspmc_company::dspmc_company_client::DspmcCompanyClient;
use gen_dspmc_helper::dspmc_helper_client::DspmcHelperClient;
use gen_dspmc_partner::dspmc_partner_client::DspmcPartnerClient;
use gen_pjc::pjc_client::PjcClient;
use gen_private_id::private_id_client::PrivateIdClient;
use gen_private_id_multi_key::private_id_multi_key_client::PrivateIdMultiKeyClient;
use gen_suid_create::suid_create_client::SuidCreateClient;
use tonic::transport::Channel;
pub enum RpcClient {
PrivateId(PrivateIdClient<Channel>),
Expand Down
Loading

0 comments on commit 13d571f

Please sign in to comment.