Skip to content

Commit

Permalink
add grpc in miner module
Browse files Browse the repository at this point in the history
  • Loading branch information
shiwk committed Aug 17, 2018
1 parent c065068 commit 14f722f
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,4 @@ slnx.sqlite

# Generated Protobuf classes
*.g.cs
*Grpc.cs
2 changes: 1 addition & 1 deletion AElf.ChainController.Rpc/AElf.ChainController.Rpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EventAggregator" Version="1.0.0" />
<PackageReference Include="Google.Protobuf" Version="3.6.0" />
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ServiceStack" Version="5.1.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion AElf.Concurrency.Worker/AElf.Concurrency.Worker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageReference Include="Akka.Cluster" Version="1.3.8" />
<PackageReference Include="Akka.Cluster.Tools" Version="1.3.8" />
<PackageReference Include="Akka.Remote" Version="1.3.8" />
<PackageReference Include="Google.Protobuf" Version="3.6.0" />
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NLog" Version="4.5.6" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion AElf.Kernel.Tests/AElf.Kernel.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.6.0" />
<PackageReference Include="Google.Protobuf" Version="3.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="Moq" Version="4.7.145" />
<PackageReference Include="ServiceStack" Version="5.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion AElf.Kernel.Types/Protobuf/Proto/kernel.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions AElf.Miner/AElf.Miner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,15 @@
<ItemGroup>
<ProjectReference Include="..\AElf.Execution\AElf.Execution.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc" Version="1.14.1" />
</ItemGroup>
<Target Name="Gen_proto" BeforeTargets="BeforeBuild">
<Exec Command="protoc -I ./Protobuf/Proto --csharp_opt=file_extension=.g.cs --csharp_out=./Protobuf/Generated/ --grpc_out=./Protobuf/Generated/ ./Protobuf/Proto/headerinfo.proto --plugin=protoc-gen-grpc=/usr/local/bin/grpc_csharp_plugin" />
</Target>
<Target Name="UpdateGeneratedFiles" DependsOnTargets="Gen_proto" BeforeTargets="BeforeBuild">
<ItemGroup>
<Compile Include="./Protobuf/Generated/*.cs" />
</ItemGroup>
</Target>
</Project>
Empty file.
6 changes: 6 additions & 0 deletions AElf.Miner/Protobuf/Proto/hash.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax = "proto3";

option csharp_namespace = "AElf.Kernel";
message Hash{
bytes Value = 1;
}
26 changes: 26 additions & 0 deletions AElf.Miner/Protobuf/Proto/headerinfo.proto
Original file line number Diff line number Diff line change
@@ -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) {}
}


7 changes: 7 additions & 0 deletions AElf.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit 14f722f

Please sign in to comment.