/*
Bicycle is a database, used for things databases are used for.

Copyright (C) 2023  sean watters

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

syntax = "proto3";
package bicycle;

// ##MODEL_MESSAGES_START##
message Examples { 
  repeated Example examples = 1; 
}
message Example {
  string pk = 1;
}
// ##MODEL_MESSAGES_END##

message IndexQuery {
  oneof expression {
    // TODO: should probably have a separate message called
    // TODO: BatchIndexQuery (or something) that allows you to submit multiple
    // TODO: query criteria so you can batch query many key ranges in
    // TODO: one round trip. concurrent reads should also help
    // TODO: application performance

    string eq = 1;
    string gte = 2;
    string lte = 3;
    string begins_with = 4;
  }
}

// Server Messages

message Empty {}

service Bicycle {
  // ##MODEL_RPCS_START##
  rpc GetExamplesByPk(IndexQuery) returns (Examples) {}
  rpc DeleteExamplesByPk(IndexQuery) returns (Empty) {}
  rpc PutExample(Example) returns (Empty) {}
  rpc BatchPutExamples(Examples) returns (Empty) {}
  // ##MODEL_RPCS_END##
}
