lib/proto_dsl/rpc.rb in proto_dsl-0.1.0 vs lib/proto_dsl/rpc.rb in proto_dsl-0.1.1
- old
+ new
@@ -22,9 +22,17 @@
output << " option #{option[0]} = #{option[1]};\n"
end
output << " }\n"
output
end
+
+ def to_server_code
+ " def #{@name}(request: #{@request_type}, context: ServerContext)\n" \
+ " # TODO: implement server logic for #{@name} RPC method\n" \
+ " response = #{@response_type}()\n" \
+ " return response\n" \
+ " end\n"
+ end
end
end
# This is the ProtoDsl::Rpc class, which defines a protobuf RPC (remote procedure call) service. A protobuf RPC service allows clients to call methods on the server by sending a request message and receiving a response message.