Skip to content

Instantly share code, notes, and snippets.

@bradclawsie
Created September 17, 2019 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradclawsie/1e4c58f829c6b462d718b86b4e9e7325 to your computer and use it in GitHub Desktop.
Save bradclawsie/1e4c58f829c6b462d718b86b4e9e7325 to your computer and use it in GitHub Desktop.
counter.proto
syntax = "proto3";
package counter;
// Value contains a countername and its present value.
message Value {
string countername = 1;
int32 value = 2;
}
// Increment contains a countername and a value to increment it by.
// Assume a counter not defined will be incremented from 0 if not defined.
message Increment {
string countername = 1;
int32 increment = 2;
}
// Read represents a request for a Value for countername.
message Read {
string countername = 1;
}
// ValueResponse can contain either a CounterValue or an error in case
// the counter is not defined.
message ValueResponse {
Value countervalue = 1;
}
// Counter is a service that allows incrementing a counter and
// reading a counter.
service Counter {
rpc IncrementCounter (Increment) returns (ValueResponse) {}
rpc ReadCounter (Read) returns (ValueResponse) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment