structs.proto 2.6 KB

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