syncthing/lib/protocol
Jakob Borg bda4016109
lib/protocol: Refactor interface (#9375)
This is a refactor of the protocol/model interface to take the actual
message as the parameter, instead of the broken-out fields:

```diff
type Model interface {
        // An index was received from the peer device
-       Index(conn Connection, folder string, files []FileInfo) error
+       Index(conn Connection, idx *Index) error
        // An index update was received from the peer device
-       IndexUpdate(conn Connection, folder string, files []FileInfo) error
+       IndexUpdate(conn Connection, idxUp *IndexUpdate) error
        // A request was made by the peer device
-       Request(conn Connection, folder, name string, blockNo, size int32, offset int64, hash []byte, weakHash uint32, fromTemporary bool) (RequestResponse, error)
+       Request(conn Connection, req *Request) (RequestResponse, error)
        // A cluster configuration message was received
-       ClusterConfig(conn Connection, config ClusterConfig) error
+       ClusterConfig(conn Connection, config *ClusterConfig) error
        // The peer device closed the connection or an error occurred
        Closed(conn Connection, err error)
        // The peer device sent progress updates for the files it is currently downloading
-       DownloadProgress(conn Connection, folder string, updates []FileDownloadProgressUpdate) error
+       DownloadProgress(conn Connection, p *DownloadProgress) error
 }
```

(and changing the `ClusterConfig` to `*ClusterConfig` for symmetry;
we'll be forced to use all pointers everywhere at some point anyway...)

The reason for this is that I have another thing cooking which is a
small troubleshooting change to check index consistency during transfer.
This required adding a field or two to the index/indexupdate messages,
and plumbing the extra parameters in umpteen changes is almost as big a
diff as this is. I figured let's do it once and avoid having to do that
in the future again...

The rest of the diff falls out of the change above, much of it being in
test code where we run these methods manually...
2024-01-31 08:18:27 +01:00
..
mocks all: Support multiple device connections (fixes #141) (#8918) 2023-09-06 12:52:01 +02:00
benchmark_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
bep_extensions.go lib/protocol: handle empty names in unixOwnershipEqual (fixes #9039) (#9306) 2023-12-29 09:16:33 +01:00
bep.pb.go all: Support multiple device connections (fixes #141) (#8918) 2023-09-06 12:52:01 +02:00
bufferpool_test.go all: Use new Go 1.19 atomic types (#8772) 2023-02-07 12:07:34 +01:00
bufferpool.go all: Use new Go 1.19 atomic types (#8772) 2023-02-07 12:07:34 +01:00
common_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
compression_test.go all: Move remaining protos to use the vanity plugin (#7009) 2020-10-02 08:07:05 +02:00
compression.go all: Move remaining protos to use the vanity plugin (#7009) 2020-10-02 08:07:05 +02:00
conflict_test.go lib/db: Refactor to use global list by version (fixes #6372) (#6638) 2020-05-30 09:50:23 +02:00
counting.go all: Add Prometheus-style metrics to expose some internal performance counters (fixes #5175) (#9003) 2023-08-04 19:57:30 +02:00
debug.go all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
deviceid_test.go gui: Keep short deviceID length consistent + xrefs (fixes #9313) (#9314) 2024-01-02 17:31:57 +01:00
deviceid_test.pb.go all: Regenerate proto (#7696) 2021-05-19 13:30:20 +02:00
deviceid.go gui: Keep short deviceID length consistent + xrefs (fixes #9313) (#9314) 2024-01-02 17:31:57 +01:00
doc.go Add 'lib/protocol/' from commit 'f91191218b192ace841c878f161832d19c09145a' 2015-09-22 19:34:29 +02:00
encryption_test.go all: Grand test refactor (fixes #8779, fixes #8799) 2023-05-09 10:01:57 +00:00
encryption.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
errors.go lib/protocol: Simplify codeToError, errorToCode 2021-10-22 18:40:40 +02:00
hello_test.go all: Support multiple device connections (fixes #141) (#8918) 2023-09-06 12:52:01 +02:00
hello.go all: Support multiple device connections (fixes #141) (#8918) 2023-09-06 12:52:01 +02:00
LICENSE Add 'lib/protocol/' from commit 'f91191218b192ace841c878f161832d19c09145a' 2015-09-22 19:34:29 +02:00
luhn_test.go lib/protocol: faster Luhn algorithm and better testing (#6475) 2020-03-29 22:28:04 +02:00
luhn.go lib/protocol: faster Luhn algorithm and better testing (#6475) 2020-03-29 22:28:04 +02:00
metrics.go all: Add Prometheus-style metrics to expose some internal performance counters (fixes #5175) (#9003) 2023-08-04 19:57:30 +02:00
mocked_connection_info_test.go all: Support multiple device connections (fixes #141) (#8918) 2023-09-06 12:52:01 +02:00
nativemodel_darwin.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
nativemodel_unix.go all: Support multiple device connections (fixes #141) (#8918) 2023-09-06 12:52:01 +02:00
nativemodel_windows_test.go lib/model, lib/protocol: Handle request concurrency in model (#5216) 2018-11-13 08:53:55 +01:00
nativemodel_windows.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
protocol_test.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
protocol.go lib/protocol: Refactor interface (#9375) 2024-01-31 08:18:27 +01:00
vector_test.go lib/protocol: Avoid data loss on database wipe by higher version numbers (fixes #3876) (#6605) 2020-05-06 08:47:02 +02:00
vector.go lib/db, lib/protocol: Never need empty-version entries (fixes #6961) (#6962) 2020-09-07 20:18:25 +02:00
wireformat.go all: Add untrusted folders behind feature flag (ref #62) (#7055) 2020-11-09 15:33:32 +01:00