structs.proto 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. syntax = "proto3";
  2. package db;
  3. import "repos/protobuf/gogoproto/gogo.proto";
  4. import "lib/protocol/bep.proto";
  5. option (gogoproto.goproto_getters_all) = false;
  6. option (gogoproto.sizer_all) = false;
  7. option (gogoproto.protosizer_all) = true;
  8. option (gogoproto.goproto_unkeyed_all) = false;
  9. option (gogoproto.goproto_unrecognized_all) = false;
  10. option (gogoproto.goproto_sizecache_all) = false;
  11. message FileVersion {
  12. protocol.Vector version = 1 [(gogoproto.nullable) = false];
  13. bytes device = 2;
  14. bool invalid = 3;
  15. }
  16. message VersionList {
  17. option (gogoproto.goproto_stringer) = false;
  18. repeated FileVersion versions = 1 [(gogoproto.nullable) = false];
  19. }
  20. // Must be the same as FileInfo but without the blocks field
  21. message FileInfoTruncated {
  22. option (gogoproto.goproto_stringer) = false;
  23. string name = 1;
  24. int64 size = 3;
  25. int64 modified_s = 5;
  26. uint64 modified_by = 12 [(gogoproto.customtype) = "github.com/syncthing/syncthing/lib/protocol.ShortID", (gogoproto.nullable) = false];
  27. protocol.Vector version = 9 [(gogoproto.nullable) = false];
  28. int64 sequence = 10;
  29. // repeated BlockInfo Blocks = 16
  30. string symlink_target = 17;
  31. bytes blocks_hash = 18;
  32. protocol.FileInfoType type = 2;
  33. uint32 permissions = 4;
  34. int32 modified_ns = 11;
  35. int32 block_size = 13 [(gogoproto.customname) = "RawBlockSize"];
  36. // see bep.proto
  37. uint32 local_flags = 1000;
  38. bool deleted = 6;
  39. bool invalid = 7 [(gogoproto.customname) = "RawInvalid"];
  40. bool no_permissions = 8;
  41. }
  42. // BlockList is the structure used to store block lists
  43. message BlockList {
  44. repeated protocol.BlockInfo Blocks = 1 [(gogoproto.nullable) = false];
  45. }
  46. // BlocksHashOnly is used to only unmarshal the block list hash from a FileInfo
  47. message BlocksHashOnly {
  48. bytes blocks_hash = 18;
  49. }
  50. // For each folder and device we keep one of these to track the current
  51. // counts and sequence. We also keep one for the global state of the folder.
  52. message Counts {
  53. int32 files = 1;
  54. int32 directories = 2;
  55. int32 symlinks = 3;
  56. int32 deleted = 4;
  57. int64 bytes = 5;
  58. int64 sequence = 6; // zero for the global state
  59. bytes deviceID = 17; // device ID for remote devices, or special values for local/global
  60. uint32 localFlags = 18; // the local flag for this count bucket
  61. }
  62. message CountsSet {
  63. repeated Counts counts = 1 [(gogoproto.nullable) = false];
  64. int64 created = 2; // unix nanos
  65. }