From 14f722f4e66fd5adaae79680f359403d32706656 Mon Sep 17 00:00:00 2001 From: swk Date: Fri, 17 Aug 2018 22:01:12 +0800 Subject: [PATCH] add grpc in miner module --- .gitignore | 1 + .../AElf.ChainController.Rpc.csproj | 2 +- .../AElf.Concurrency.Worker.csproj | 2 +- AElf.Kernel.Tests/AElf.Kernel.Tests.csproj | 2 +- AElf.Kernel.Types/Protobuf/Proto/kernel.proto | 2 +- AElf.Miner/AElf.Miner.csproj | 11 ++++++++ AElf.Miner/Protobuf/Generated/.gitkeep | 0 AElf.Miner/Protobuf/Proto/hash.proto | 6 +++++ AElf.Miner/Protobuf/Proto/headerinfo.proto | 26 +++++++++++++++++++ AElf.sln | 7 +++++ 10 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 AElf.Miner/Protobuf/Generated/.gitkeep create mode 100644 AElf.Miner/Protobuf/Proto/hash.proto create mode 100644 AElf.Miner/Protobuf/Proto/headerinfo.proto diff --git a/.gitignore b/.gitignore index f64c471715..96f1ff22ed 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,4 @@ slnx.sqlite # Generated Protobuf classes *.g.cs +*Grpc.cs \ No newline at end of file diff --git a/AElf.ChainController.Rpc/AElf.ChainController.Rpc.csproj b/AElf.ChainController.Rpc/AElf.ChainController.Rpc.csproj index e30af1e3ed..a28917986c 100644 --- a/AElf.ChainController.Rpc/AElf.ChainController.Rpc.csproj +++ b/AElf.ChainController.Rpc/AElf.ChainController.Rpc.csproj @@ -9,7 +9,7 @@ - + diff --git a/AElf.Concurrency.Worker/AElf.Concurrency.Worker.csproj b/AElf.Concurrency.Worker/AElf.Concurrency.Worker.csproj index 069a56ca06..b3af7d85a9 100644 --- a/AElf.Concurrency.Worker/AElf.Concurrency.Worker.csproj +++ b/AElf.Concurrency.Worker/AElf.Concurrency.Worker.csproj @@ -8,7 +8,7 @@ - + diff --git a/AElf.Kernel.Tests/AElf.Kernel.Tests.csproj b/AElf.Kernel.Tests/AElf.Kernel.Tests.csproj index 396db3b599..685c0bb8d4 100644 --- a/AElf.Kernel.Tests/AElf.Kernel.Tests.csproj +++ b/AElf.Kernel.Tests/AElf.Kernel.Tests.csproj @@ -4,7 +4,7 @@ false - + diff --git a/AElf.Kernel.Types/Protobuf/Proto/kernel.proto b/AElf.Kernel.Types/Protobuf/Proto/kernel.proto index 47949ddd6a..93f0ce6974 100644 --- a/AElf.Kernel.Types/Protobuf/Proto/kernel.proto +++ b/AElf.Kernel.Types/Protobuf/Proto/kernel.proto @@ -34,7 +34,7 @@ enum Status { message TransactionResult{ Hash TransactionId = 1; - Status status = 2; + Status Status = 2; repeated LogEvent Logs = 3; bytes Bloom = 4; bytes RetVal = 5; diff --git a/AElf.Miner/AElf.Miner.csproj b/AElf.Miner/AElf.Miner.csproj index a4b7e96ca4..6f6e79fedc 100644 --- a/AElf.Miner/AElf.Miner.csproj +++ b/AElf.Miner/AElf.Miner.csproj @@ -5,4 +5,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/AElf.Miner/Protobuf/Generated/.gitkeep b/AElf.Miner/Protobuf/Generated/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/AElf.Miner/Protobuf/Proto/hash.proto b/AElf.Miner/Protobuf/Proto/hash.proto new file mode 100644 index 0000000000..3648e9762a --- /dev/null +++ b/AElf.Miner/Protobuf/Proto/hash.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; + +option csharp_namespace = "AElf.Kernel"; +message Hash{ + bytes Value = 1; +} diff --git a/AElf.Miner/Protobuf/Proto/headerinfo.proto b/AElf.Miner/Protobuf/Proto/headerinfo.proto new file mode 100644 index 0000000000..b82cac9c29 --- /dev/null +++ b/AElf.Miner/Protobuf/Proto/headerinfo.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +option csharp_namespace = "AElf.Miner"; +import "hash.proto"; + +message ReponseIndexedInfo{ + repeated HeaderInfo Headers = 1; +} + + +message RequestIndexedInfo{ + Hash from = 1; + uint64 begin = 2; +} + +message HeaderInfo{ + Hash BlockHeaderHash = 1; + Hash TransactionHash = 2; + Hash WorldStateHash = 3; +} + +service RouteGuide { + rpc GetHeaderInfo(RequestIndexedInfo) returns (ReponseIndexedInfo) {} +} + + diff --git a/AElf.sln b/AElf.sln index 31e1fa11b7..bfd4d19722 100644 --- a/AElf.sln +++ b/AElf.sln @@ -115,6 +115,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.SideChain", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Miner", "AElf.Miner\AElf.Miner.csproj", "{E6CC3DBC-471B-4B17-A540-6AEEE0FBABBD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Miner.Rpc", "AElf.Miner.Rpc\AElf.Miner.Rpc.csproj", "{2E9B78E2-EB9F-420B-A413-580164B00911}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -341,6 +343,10 @@ Global {E6CC3DBC-471B-4B17-A540-6AEEE0FBABBD}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6CC3DBC-471B-4B17-A540-6AEEE0FBABBD}.Release|Any CPU.ActiveCfg = Release|Any CPU {E6CC3DBC-471B-4B17-A540-6AEEE0FBABBD}.Release|Any CPU.Build.0 = Release|Any CPU + {2E9B78E2-EB9F-420B-A413-580164B00911}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E9B78E2-EB9F-420B-A413-580164B00911}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E9B78E2-EB9F-420B-A413-580164B00911}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E9B78E2-EB9F-420B-A413-580164B00911}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -351,5 +357,6 @@ Global GlobalSection(NestedProjects) = preSolution {2AE2D692-6450-4339-B725-F6DF76CDF437} = {6037B755-5BBF-4515-81AB-B63C52A4D067} {AE13A559-B20D-4680-971A-17BAD5C2AFE6} = {6037B755-5BBF-4515-81AB-B63C52A4D067} + {2E9B78E2-EB9F-420B-A413-580164B00911} = {6037B755-5BBF-4515-81AB-B63C52A4D067} EndGlobalSection EndGlobal