{"action":"created","issue":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/3276","repository_url":"https://api.github.com/repos/syncthing/syncthing","labels_url":"https://api.github.com/repos/syncthing/syncthing/issues/3276/labels{/name}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/3276/comments","events_url":"https://api.github.com/repos/syncthing/syncthing/issues/3276/events","html_url":"https://github.com/syncthing/syncthing/pull/3276","id":158876074,"number":3276,"title":"Use protocol buffers instead of custom XDR","user":{"login":"calmh","id":125426,"avatar_url":"https://avatars.githubusercontent.com/u/125426?v=3","gravatar_id":"","url":"https://api.github.com/users/calmh","html_url":"https://github.com/calmh","followers_url":"https://api.github.com/users/calmh/followers","following_url":"https://api.github.com/users/calmh/following{/other_user}","gists_url":"https://api.github.com/users/calmh/gists{/gist_id}","starred_url":"https://api.github.com/users/calmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calmh/subscriptions","organizations_url":"https://api.github.com/users/calmh/orgs","repos_url":"https://api.github.com/users/calmh/repos","events_url":"https://api.github.com/users/calmh/events{/privacy}","received_events_url":"https://api.github.com/users/calmh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":41,"created_at":"2016-06-07T09:17:25Z","updated_at":"2016-06-18T18:07:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/syncthing/syncthing/pulls/3276","html_url":"https://github.com/syncthing/syncthing/pull/3276","diff_url":"https://github.com/syncthing/syncthing/pull/3276.diff","patch_url":"https://github.com/syncthing/syncthing/pull/3276.patch"},"body":"**Not done, not for merging, just for review and discussion.**\r\n\r\nThis changes our serialization code to use protocol buffers instead of our custom code. Todo/done:\r\n\r\n- [X] Protocol structs should be protobuf\r\n- [X] Database structs should be protobuf\r\n- [x] Local discovery structs should be protobuf\r\nby humans?\r\n- [x] Clean up bitfields vs booleans (as per Audrius stuff)\r\n- [x] Remove currently unused fields as these can be added painlessly in the future\r\n\r\nChanges I think we should *not* do:\r\n\r\n- The global discovery protocol. No need, might be nice to have human readable, no real reason to cause the disturbance.\r\n- The relay protocol, as far as it concerns speaking *to* a relay. No reason to break it currently and leaving it unchanged lets us reap the benefits of the deployed infrastructure.\r\n\r\nSome changes that were necessary but unexpected or non-obvious:\r\n\r\n- ~~The protobuf serializer uses a `Size()` method which conflicted with our `Size` fields on `BlockInfo`. I've renamed it to `Length`.~~\r\n- I've added a `Size` field instead of `CachedSize` to `FileInfo` and let this be serialized everywhere. It means we get it for free in the `TruncatedFileInfo` instead of having to extract it from the block list.\r\n- ~~The `TruncatedFileInfo` type is \"officialized\" and moved into the protocol package, but it's still mostly used by the database. I'm not sure of this, maybe it can be undone and moved back to db as we have some protobufs stuff there as well (but didn't when I first made this change)...~~\r\n- The version vector `type Vector []Counter` definition doesn't work with protobuf so I had to make it a struct which resulted in a lot of tedious changes everywhere, but it's conceptually the same.\r\n- I added `FileName()` and `FileLength()` methods to the interface that covers both `FileInfo` and `FileInfoTruncated` so we can get the name or size of the interface without having to type assert to the underlying type.\r\n- I threw out the conversion from 0.12 db:s. We'll need full rescan for this change, but on the other hand it ought to be the last time ever."},"comment":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/comments/226956468","html_url":"https://github.com/syncthing/syncthing/pull/3276#issuecomment-226956468","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/3276","id":226956468,"user":{"login":"calmh","id":125426,"avatar_url":"https://avatars.githubusercontent.com/u/125426?v=3","gravatar_id":"","url":"https://api.github.com/users/calmh","html_url":"https://github.com/calmh","followers_url":"https://api.github.com/users/calmh/followers","following_url":"https://api.github.com/users/calmh/following{/other_user}","gists_url":"https://api.github.com/users/calmh/gists{/gist_id}","starred_url":"https://api.github.com/users/calmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calmh/subscriptions","organizations_url":"https://api.github.com/users/calmh/orgs","repos_url":"https://api.github.com/users/calmh/repos","events_url":"https://api.github.com/users/calmh/events{/privacy}","received_events_url":"https://api.github.com/users/calmh/received_events","type":"User","site_admin":false},"created_at":"2016-06-18T18:07:32Z","updated_at":"2016-06-18T18:07:32Z","body":"It was somewhat annoying to serialize as everything is variable size and need to be concatenated together. This way it's mostly one thing to marshal/unmarshal and the alternating length/message/length/message order is simple to understand and handle. I was thinking this would make more sense to people used to protocol buffers and nothing else, but maybe that's wrong?"}}
{"actor":{"display_login":"calmh"}}