MCPcopy
hub / github.com/syncthing/syncthing / messageContext

Function messageContext

lib/protocol/protocol.go:1106–1127  ·  view source on GitHub ↗
(msg proto.Message)

Source from the content-addressed store, hash-verified

1104}
1105
1106func messageContext(msg proto.Message) (string, error) {
1107 switch msg := msg.(type) {
1108 case *bep.ClusterConfig:
1109 return "cluster-config", nil
1110 case *bep.Index:
1111 return fmt.Sprintf("index for %v", msg.Folder), nil
1112 case *bep.IndexUpdate:
1113 return fmt.Sprintf("index-update for %v", msg.Folder), nil
1114 case *bep.Request:
1115 return fmt.Sprintf(`request for "%v" in %v`, msg.Name, msg.Folder), nil
1116 case *bep.Response:
1117 return "response", nil
1118 case *bep.DownloadProgress:
1119 return fmt.Sprintf("download-progress for %v", msg.Folder), nil
1120 case *bep.Ping:
1121 return "ping", nil
1122 case *bep.Close:
1123 return "close", nil
1124 default:
1125 return "", errors.New("unknown or empty message")
1126 }
1127}
1128
1129// connectionWrappingModel takes the Model interface from the model package,
1130// which expects the Connection as the first parameter in all methods, and

Callers 2

dispatcherLoopMethod · 0.85
writeMessageMethod · 0.85

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected