structs.proto 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. syntax = "proto3";
  2. package dbproto;
  3. import "bep/bep.proto";
  4. import "google/protobuf/timestamp.proto";
  5. // Same as bep.FileInfo, but without blocks
  6. message FileInfoTruncated {
  7. string name = 1;
  8. int64 size = 3;
  9. int64 modified_s = 5;
  10. uint64 modified_by = 12;
  11. bep.Vector version = 9;
  12. int64 sequence = 10;
  13. reserved 16; // blocks
  14. bytes symlink_target = 17;
  15. bytes blocks_hash = 18;
  16. bytes previous_blocks_hash = 20;
  17. bytes encrypted = 19;
  18. bep.FileInfoType type = 2;
  19. uint32 permissions = 4;
  20. int32 modified_ns = 11;
  21. int32 block_size = 13;
  22. bep.PlatformData platform = 14;
  23. // The local_flags fields stores flags that are relevant to the local
  24. // host only. It is not part of the protocol, doesn't get sent or
  25. // received (we make sure to zero it), nonetheless we need it on our
  26. // struct and to be able to serialize it to/from the database.
  27. uint32 local_flags = 1000;
  28. // The version_hash is an implementation detail and not part of the wire
  29. // format.
  30. bytes version_hash = 1001;
  31. // The time when the inode was last changed (i.e., permissions, xattrs
  32. // etc changed). This is host-local, not sent over the wire.
  33. int64 inode_change_ns = 1002;
  34. // The size of the data appended to the encrypted file on disk. This is
  35. // host-local, not sent over the wire.
  36. int32 encryption_trailer_size = 1003;
  37. bool deleted = 6;
  38. bool invalid = 7;
  39. bool no_permissions = 8;
  40. }
  41. message FileVersion {
  42. bep.Vector version = 1;
  43. bool deleted = 2;
  44. repeated bytes devices = 3;
  45. repeated bytes invalid_devices = 4;
  46. }
  47. message VersionList {
  48. repeated FileVersion versions = 1;
  49. }
  50. // BlockList is the structure used to store block lists
  51. message BlockList {
  52. repeated bep.BlockInfo blocks = 1;
  53. }
  54. // IndirectionHashesOnly is used to only unmarshal the indirection hashes
  55. // from a FileInfo
  56. message IndirectionHashesOnly {
  57. bytes blocks_hash = 18;
  58. bytes version_hash = 1001;
  59. }
  60. // For each folder and device we keep one of these to track the current
  61. // counts and sequence. We also keep one for the global state of the folder.
  62. message Counts {
  63. int32 files = 1;
  64. int32 directories = 2;
  65. int32 symlinks = 3;
  66. int32 deleted = 4;
  67. int64 bytes = 5;
  68. int64 sequence = 6; // zero for the global state
  69. bytes device_id = 17; // device ID for remote devices, or special values for local/global
  70. uint32 local_flags = 18; // the local flag for this count bucket
  71. }
  72. message CountsSet {
  73. repeated Counts counts = 1;
  74. int64 created = 2; // unix nanos
  75. }
  76. message ObservedFolder {
  77. google.protobuf.Timestamp time = 1;
  78. string label = 2;
  79. bool receive_encrypted = 3;
  80. bool remote_encrypted = 4;
  81. }
  82. message ObservedDevice {
  83. google.protobuf.Timestamp time = 1;
  84. string name = 2;
  85. string address = 3;
  86. }