You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.3 KiB

  1. syntax = "proto3";
  2. package protodb;
  3. message Batch {
  4. repeated Operation ops = 1;
  5. }
  6. message Operation {
  7. Entity entity = 1;
  8. enum Type {
  9. SET = 0;
  10. DELETE = 1;
  11. }
  12. Type type = 2;
  13. }
  14. message Entity {
  15. int32 id = 1;
  16. bytes key = 2;
  17. bytes value = 3;
  18. bool exists = 4;
  19. bytes start = 5;
  20. bytes end = 6;
  21. string err = 7;
  22. int64 created_at = 8;
  23. }
  24. message Nothing {
  25. }
  26. message Domain {
  27. bytes start = 1;
  28. bytes end = 2;
  29. }
  30. message Iterator {
  31. Domain domain = 1;
  32. bool valid = 2;
  33. bytes key = 3;
  34. bytes value = 4;
  35. }
  36. message Stats {
  37. map<string, string> data = 1;
  38. int64 time_at = 2;
  39. }
  40. message Init {
  41. string Type = 1;
  42. string Name = 2;
  43. string Dir = 3;
  44. }
  45. service DB {
  46. rpc init(Init) returns (Entity) {}
  47. rpc get(Entity) returns (Entity) {}
  48. rpc getStream(stream Entity) returns (stream Entity) {}
  49. rpc has(Entity) returns (Entity) {}
  50. rpc set(Entity) returns (Nothing) {}
  51. rpc setSync(Entity) returns (Nothing) {}
  52. rpc delete(Entity) returns (Nothing) {}
  53. rpc deleteSync(Entity) returns (Nothing) {}
  54. rpc iterator(Entity) returns (stream Iterator) {}
  55. rpc reverseIterator(Entity) returns (stream Iterator) {}
  56. // rpc print(Nothing) returns (Entity) {}
  57. rpc stats(Nothing) returns (Stats) {}
  58. rpc batchWrite(Batch) returns (Nothing) {}
  59. rpc batchWriteSync(Batch) returns (Nothing) {}
  60. }