chord.proto 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. syntax = "proto3";
  2. package models;
  3. // Chord is the service for inter-node communication.
  4. // This has all the RPC functions needed to maintain
  5. // a Chord cluster.
  6. service Chord {
  7. // GetPredecessor returns the node believed to be the current predecessor.
  8. rpc GetPredecessor(ER) returns (Node);
  9. // GetSuccessor returns the node believed to be the current successor.
  10. rpc GetSuccessor(ER) returns (Node);
  11. // Notify notifies Chord that Node thinks it is our predecessor. This has
  12. // the potential to initiate the transferring of keys.
  13. rpc Notify(Node) returns (ER);
  14. // FindSuccessor finds the node the succedes ID. May initiate RPC calls to
  15. // other nodes.
  16. rpc FindSuccessor(ID) returns (Node);
  17. // CheckPredecessor checkes whether predecessor has failed.
  18. rpc CheckPredecessor(ID) returns (ER);
  19. // SetPredecessor sets predecessor for a node.
  20. rpc SetPredecessor(Node) returns (ER);
  21. // SetPredecessor sets predecessor for a node.
  22. rpc SetSuccessor(Node) returns (ER);
  23. // Get returns the value in Chord ring for the given key.
  24. rpc XGet(GetRequest) returns (GetResponse);
  25. // Set writes a key value pair to the Chord ring.
  26. rpc XSet(SetRequest) returns (SetResponse);
  27. // Delete returns the value in Chord ring for the given key.
  28. rpc XDelete(DeleteRequest) returns (DeleteResponse);
  29. // Multiple delete returns the value in Chord ring between the given keys.
  30. rpc XMultiDelete(MultiDeleteRequest) returns (DeleteResponse);
  31. // RequestKeys returns the keys between given range from the Chord ring.
  32. rpc XRequestKeys(RequestKeysRequest) returns (RequestKeysResponse);
  33. }
  34. // Node contains a node ID and address.
  35. message Node {
  36. bytes id = 1;
  37. string addr = 2;
  38. }
  39. message ER {}
  40. message ID {
  41. bytes id = 1;
  42. }
  43. message GetRequest {
  44. string key = 1;
  45. }
  46. message GetResponse {
  47. bytes value = 1;
  48. }
  49. message SetRequest {
  50. string key = 1;
  51. string value = 2;
  52. }
  53. message SetResponse {}
  54. message DeleteRequest {
  55. string key = 1;
  56. }
  57. message DeleteResponse {
  58. }
  59. message MultiDeleteRequest {
  60. repeated string keys = 1;
  61. }
  62. message RequestKeysRequest {
  63. bytes from = 1;
  64. bytes to = 2;
  65. }
  66. message KV {
  67. string key = 1;
  68. string value = 2;
  69. }
  70. message RequestKeysResponse {
  71. repeated KV values = 1;
  72. }