Changeset View
Changeset View
Standalone View
Standalone View
services/identity/src/service.rs
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
mod proto { | mod proto { | ||||
tonic::include_proto!("identity"); | tonic::include_proto!("identity"); | ||||
} | } | ||||
mod login; | mod login; | ||||
mod registration; | mod registration; | ||||
mod update; | |||||
#[derive(Debug)] | #[derive(Debug)] | ||||
enum PakeWorkflow { | enum PakeWorkflow { | ||||
Registration, | Registration, | ||||
Login, | Login, | ||||
} | } | ||||
#[derive(derive_more::Constructor)] | #[derive(derive_more::Constructor)] | ||||
▲ Show 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | ) -> Result<Response<GetSessionInitializationInfoResponse>, Status> { | ||||
} | } | ||||
} | } | ||||
#[instrument(skip(self))] | #[instrument(skip(self))] | ||||
async fn update_user( | async fn update_user( | ||||
&self, | &self, | ||||
request: Request<tonic::Streaming<UpdateUserRequest>>, | request: Request<tonic::Streaming<UpdateUserRequest>>, | ||||
) -> Result<Response<Self::UpdateUserStream>, Status> { | ) -> Result<Response<Self::UpdateUserStream>, Status> { | ||||
unimplemented!(); | let (tx, rx) = mpsc::channel(MPSC_CHANNEL_BUFFER_CAPACITY); | ||||
let db_client = self.client.clone(); | |||||
tokio::spawn(async move { | |||||
update::handle_server_update_user_messages( | |||||
request.into_inner(), | |||||
db_client, | |||||
tx, | |||||
) | |||||
.await; | |||||
}); | |||||
let out_stream = ReceiverStream::new(rx); | |||||
Ok(Response::new(Box::pin(out_stream) as Self::UpdateUserStream)) | |||||
} | } | ||||
type UpdateUserStream = Pin< | type UpdateUserStream = Pin< | ||||
Box<dyn Stream<Item = Result<UpdateUserResponse, Status>> + Send + 'static>, | Box<dyn Stream<Item = Result<UpdateUserResponse, Status>> + Send + 'static>, | ||||
>; | >; | ||||
} | } | ||||
async fn put_token_helper( | async fn put_token_helper( | ||||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |