Goddess of Justice DB, the database used for storage on IzaroDFS
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

83 lignes
2.1 KiB

il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
  1. #pragma once
  2. #include "endian.hpp"
  3. #include "database.hpp"
  4. /*************************************/
  5. /* STORAGE SERVER */
  6. /*************************************/
  7. enum class db_op : uint32_t {
  8. version = 0,
  9. read = 1,
  10. write = 2,
  11. remove = 3,
  12. stats = 4,
  13. sread = 5,
  14. swrite = (2 << 16) + write,
  15. sallocate = 7,
  16. sremove = (2 << 16) + remove,
  17. confirm = 8,
  18. bulk_write = (2 << 15) + write
  19. };
  20. struct [[gnu::packed]] received_data {
  21. bitops::regulated<db_op> op = db_op::version;
  22. bitops::regulated<uint64_t> rep_id = 0;
  23. record_identifier identifier = record_identifier{};
  24. db_page page = {0};
  25. };
  26. struct [[gnu::packed]] received_bulk_data {
  27. bitops::regulated<db_op> op = db_op::version;
  28. bitops::regulated<uint64_t> rep_id = 0;
  29. bitops::regulated<uint32_t> nb_count = 0;
  30. std::array<record_identifier, 4096/sizeof(record_identifier)> identifiers;
  31. std::array<db_page, 4096/sizeof(record_identifier)> page;
  32. };
  33. struct [[gnu::packed]] sending_data {
  34. bitops::regulated<uint64_t> rep_id = 0;
  35. record identifier = record{};
  36. db_page page = {0};
  37. };
  38. struct [[gnu::packed]] stats_data {
  39. bitops::regulated<uint64_t> free;
  40. bitops::regulated<uint64_t> free_deleted;
  41. bitops::regulated<uint64_t> total_pages;
  42. bitops::regulated<uint64_t> total_records;
  43. bitops::regulated<uint64_t> total_delete;
  44. bitops::regulated<uint64_t> cow_full;
  45. bitops::regulated<uint64_t> free_records;
  46. bitops::regulated<uint64_t> sync_rate_µs;
  47. bitops::regulated<uint64_t> sync_duration_µs;
  48. bitops::regulated<uint64_t> max_sync_duration_µs;
  49. bitops::regulated<uint64_t> avg_sync_duration_µs;
  50. };
  51. /*************************************/
  52. /* COORDINATE SERVER */
  53. /*************************************/
  54. enum class coord_op : uint32_t {
  55. version = 0,
  56. read = 1,
  57. write = 2,
  58. remove = 3,
  59. stats = 4
  60. };
  61. struct [[gnu::packed]] received_data_coord {
  62. bitops::regulated<db_op> op = db_op::version;
  63. bitops::regulated<uint64_t> rep_id = 0;
  64. record_identifier identifier = record_identifier{};
  65. db_page pageA = {0};
  66. db_page pageB = {0};
  67. };
  68. struct req_rep {
  69. uint64_t id = 0;
  70. uint64_t client_ts = 0;
  71. bitops::regulated<uint64_t> server_ts = 0;
  72. };