fix new grpc modification
implemented dummy grpc service
This commit is contained in:
		
							parent
							
								
									b0990521f2
								
							
						
					
					
						commit
						c6bb7f5ab1
					
				
							
								
								
									
										24
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										24
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -316,7 +316,7 @@ dependencies = [ | |||||||
| [[package]] | [[package]] | ||||||
| name = "detee-shared" | name = "detee-shared" | ||||||
| version = "0.1.0" | version = "0.1.0" | ||||||
| source = "git+ssh://git@gitea.detee.cloud/noormohammedb/detee-shared#f4e1159efc1987a1ca6e079617719527875957bf" | source = "git+ssh://git@gitea.detee.cloud/noormohammedb/detee-shared#3cb47a47e824edb4df8f2057f3d9dfa2a04f9e76" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "base64", |  "base64", | ||||||
|  "prost", |  "prost", | ||||||
| @ -523,7 +523,7 @@ dependencies = [ | |||||||
|  "futures-core", |  "futures-core", | ||||||
|  "futures-sink", |  "futures-sink", | ||||||
|  "http", |  "http", | ||||||
|  "indexmap 2.7.0", |  "indexmap 2.7.1", | ||||||
|  "slab", |  "slab", | ||||||
|  "tokio", |  "tokio", | ||||||
|  "tokio-util", |  "tokio-util", | ||||||
| @ -860,9 +860,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "indexmap" | name = "indexmap" | ||||||
| version = "2.7.0" | version = "2.7.1" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" | checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "equivalent", |  "equivalent", | ||||||
|  "hashbrown 0.15.2", |  "hashbrown 0.15.2", | ||||||
| @ -1063,9 +1063,9 @@ dependencies = [ | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "openssl-probe" | name = "openssl-probe" | ||||||
| version = "0.1.5" | version = "0.1.6" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" | checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "openssl-sys" | name = "openssl-sys" | ||||||
| @ -1092,7 +1092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||||||
| checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" | checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "fixedbitset", |  "fixedbitset", | ||||||
|  "indexmap 2.7.0", |  "indexmap 2.7.1", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| @ -1357,9 +1357,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "rustix" | name = "rustix" | ||||||
| version = "0.38.43" | version = "0.38.44" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" | checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "bitflags", |  "bitflags", | ||||||
|  "errno", |  "errno", | ||||||
| @ -1501,7 +1501,7 @@ version = "0.0.12" | |||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "59e2dd588bf1597a252c3b920e0143eb99b0f76e4e082f4c92ce34fbc9e71ddd" | checksum = "59e2dd588bf1597a252c3b920e0143eb99b0f76e4e082f4c92ce34fbc9e71ddd" | ||||||
| dependencies = [ | dependencies = [ | ||||||
|  "indexmap 2.7.0", |  "indexmap 2.7.1", | ||||||
|  "itoa", |  "itoa", | ||||||
|  "libyml", |  "libyml", | ||||||
|  "memchr", |  "memchr", | ||||||
| @ -1847,9 +1847,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" | |||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "unicode-ident" | name = "unicode-ident" | ||||||
| version = "1.0.14" | version = "1.0.15" | ||||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||||
| checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" | checksum = "11cd88e12b17c6494200a9c1b683a04fcac9573ed74cd1b62aeb2727c5592243" | ||||||
| 
 | 
 | ||||||
| [[package]] | [[package]] | ||||||
| name = "untrusted" | name = "untrusted" | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| use anyhow::Result; | use anyhow::Result; | ||||||
| 
 | 
 | ||||||
| use detee_shared::config::Container as ContainerConfig; | use detee_shared::pb_types::shared::Container as ContainerConfig; | ||||||
| use detee_shared::config::Resource as ResourceConfig; | use detee_shared::pb_types::shared::Resource as ResourceConfig; | ||||||
| 
 | 
 | ||||||
| use crate::package::deploy_enclave; | use crate::package::deploy_enclave; | ||||||
| 
 | 
 | ||||||
| @ -12,7 +12,7 @@ pub struct DaemonState { | |||||||
| 
 | 
 | ||||||
| #[derive(Debug, Default)] | #[derive(Debug, Default)] | ||||||
| pub struct Container { | pub struct Container { | ||||||
|     pub id: String, |     pub uuid: String, | ||||||
|     pub name: String, |     pub name: String, | ||||||
|     pub package_path: String, |     pub package_path: String, | ||||||
|     pub status: String, |     pub status: String, | ||||||
| @ -37,7 +37,7 @@ impl DaemonState { | |||||||
|         let mapped_ports = deploy_enclave(&unarchive_dir, publishing_ports).await?; |         let mapped_ports = deploy_enclave(&unarchive_dir, publishing_ports).await?; | ||||||
| 
 | 
 | ||||||
|         let container = Container { |         let container = Container { | ||||||
|             id: "123".to_string(), |             uuid: req_data.uuid.unwrap_or_default().uuid, | ||||||
|             name: "".to_string(), |             name: "".to_string(), | ||||||
|             package_path: unarchive_dir, |             package_path: unarchive_dir, | ||||||
|             status: "running".to_string(), |             status: "running".to_string(), | ||||||
|  | |||||||
							
								
								
									
										44
									
								
								src/grpc.rs
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										44
									
								
								src/grpc.rs
									
									
									
									
									
								
							| @ -9,10 +9,12 @@ use tonic::transport::Server; | |||||||
| use detee_shared::pb::daemon::daemon_service_server::{ | use detee_shared::pb::daemon::daemon_service_server::{ | ||||||
|     DaemonService as DaemonServicePB, DaemonServiceServer as DaemonServiceServerPB, |     DaemonService as DaemonServicePB, DaemonServiceServer as DaemonServiceServerPB, | ||||||
| }; | }; | ||||||
| use detee_shared::pb::daemon::NewContainerRes; | use detee_shared::pb::daemon::{ | ||||||
|  |     ContainerFilters, ContainerInspectResp, ContainerListResp, DeleteContainerRes, NewContainerRes, | ||||||
|  | }; | ||||||
| use detee_shared::pb::shared::Container as ContainerPB; | use detee_shared::pb::shared::Container as ContainerPB; | ||||||
| 
 | 
 | ||||||
| use detee_shared::config::Container as ContainerConfig; | use detee_shared::pb_types::shared::Container as ContainerConfig; | ||||||
| 
 | 
 | ||||||
| use crate::package::handle_package; | use crate::package::handle_package; | ||||||
| use crate::DaemonState; | use crate::DaemonState; | ||||||
| @ -70,7 +72,45 @@ impl DaemonServicePB for DaemonServer { | |||||||
|             .map_err(|err| tonic::Status::internal(err.to_string()))?; |             .map_err(|err| tonic::Status::internal(err.to_string()))?; | ||||||
| 
 | 
 | ||||||
|         return Ok(tonic::Response::new(NewContainerRes { |         return Ok(tonic::Response::new(NewContainerRes { | ||||||
|  |             container_id: None, | ||||||
|             status: "success".to_string(), |             status: "success".to_string(), | ||||||
|  |             ip_address: "".to_string(), | ||||||
|  |         })); | ||||||
|  |     } | ||||||
|  |     async fn inspect_container( | ||||||
|  |         &self, | ||||||
|  |         req: tonic::Request<detee_shared::pb::shared::Uuid>, | ||||||
|  |     ) -> Result<tonic::Response<ContainerInspectResp>, tonic::Status> { | ||||||
|  |         dbg!(req); | ||||||
|  |         return Ok(tonic::Response::new(ContainerInspectResp { | ||||||
|  |             ..Default::default() | ||||||
|  |         })); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // async fn container_log(
 | ||||||
|  |     //     &self,
 | ||||||
|  |     //     req: tonic::Request<detee_shared::pb::shared::Uuid>,
 | ||||||
|  |     // ) -> Result<tonic::Response<Self::ContainerLogStream>, tonic::Status> {
 | ||||||
|  |     //     todo!()
 | ||||||
|  |     // }
 | ||||||
|  | 
 | ||||||
|  |     async fn list_containers( | ||||||
|  |         &self, | ||||||
|  |         req: tonic::Request<ContainerFilters>, | ||||||
|  |     ) -> Result<tonic::Response<ContainerListResp>, tonic::Status> { | ||||||
|  |         dbg!(req); | ||||||
|  |         return Ok(tonic::Response::new(ContainerListResp { | ||||||
|  |             ..Default::default() | ||||||
|  |         })); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     async fn delete_container( | ||||||
|  |         &self, | ||||||
|  |         req: tonic::Request<detee_shared::pb::shared::Uuid>, | ||||||
|  |     ) -> Result<tonic::Response<DeleteContainerRes>, tonic::Status> { | ||||||
|  |         dbg!(req); | ||||||
|  |         return Ok(tonic::Response::new(DeleteContainerRes { | ||||||
|  |             ..Default::default() | ||||||
|         })); |         })); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user