// Copyright (c) 2015, Google Inc.
//
// 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.

syntax = "proto3";

package google.bigtable.v1;

import "google.golang.org/cloud/bigtable/internal/data_proto/bigtable_data.proto";
import "google.golang.org/cloud/bigtable/internal/service_proto/bigtable_service_messages.proto";
import "google.golang.org/cloud/bigtable/internal/empty/empty.proto";

option java_generic_services = true;
option java_multiple_files = true;
option java_outer_classname = "BigtableServicesProto";
option java_package = "com.google.bigtable.v1";


// Service for reading from and writing to existing Bigtables.
service BigtableService {
  // Streams back the contents of all requested rows, optionally applying
  // the same Reader filter to each. Depending on their size, rows may be
  // broken up across multiple responses, but atomicity of each row will still
  // be preserved.
  rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) {
  }

  // Returns a sample of row keys in the table. The returned row keys will
  // delimit contiguous sections of the table of approximately equal size,
  // which can be used to break up the data for distributed tasks like
  // mapreduces.
  rpc SampleRowKeys(SampleRowKeysRequest) returns (stream SampleRowKeysResponse) {
  }

  // Mutates a row atomically. Cells already present in the row are left
  // unchanged unless explicitly changed by 'mutation'.
  rpc MutateRow(MutateRowRequest) returns (google.protobuf.Empty) {
  }

  // Mutates a row atomically based on the output of a predicate Reader filter.
  rpc CheckAndMutateRow(CheckAndMutateRowRequest) returns (CheckAndMutateRowResponse) {
  }

  // Modifies a row atomically, reading the latest existing timestamp/value from
  // the specified columns and writing a new value at
  // max(existing timestamp, current server time) based on pre-defined
  // read/modify/write rules. Returns the new contents of all modified cells.
  rpc ReadModifyWriteRow(ReadModifyWriteRowRequest) returns (Row) {
  }
}
