// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// IntStore is a service for testing the rpcreplay package.
// It is a simple key-value store for integers.

syntax = "proto3";

package intstore;

service IntStore {
  rpc Set(Item) returns (SetResponse) {}

  rpc Get(GetRequest) returns (Item) {}

  // A server-to-client streaming RPC.
  rpc ListItems(ListItemsRequest) returns (stream Item) {}

  // A client-to-server streaming RPC.
  rpc SetStream(stream Item) returns (Summary) {}

  // A Bidirectional streaming RPC.
  rpc StreamChat(stream Item) returns (stream Item) {}
}

message Item {
  string name = 1;
  int32 value = 2;
}

message SetResponse {
  int32 prev_value = 1;
}

message GetRequest {
  string name = 1;
}

message Summary {
  int32 count = 1;
}

message ListItemsRequest {
  // Only list items whose value is greater than this.
  int32 greaterThan = 1;
}
