| 1 | | | import '../channel.dart'; |
| 2 | | | |
| 3 | | | /// Annotation for service methods to be exposed by workers. |
| 4 | | | class SquadronMethod { |
| 5 | | 12 | const SquadronMethod({ |
| 6 | | | this.inspectRequest = false, |
| 7 | | | this.inspectResponse = false, |
| 8 | | | this.withContext, |
| 9 | | | }); |
| 10 | | | |
| 11 | | | /// Indicates whether the contents of the incoming message should be |
| 12 | | | /// inspected by Squadron before sending the request to the worker. By |
| 13 | | | /// default, incoming messages are not inspected except for the startup |
| 14 | | | /// message. The purpose of message inspection is to detect non-base-type |
| 15 | | | /// data that require transfer of ownership to the target worker. E.g. if |
| 16 | | | /// the request data include a [Channel] object, [inspectRequest] must be |
| 17 | | | /// set to `true`. |
| 18 | | | final bool inspectRequest; |
| 19 | | | |
| 20 | | | /// Same as [inspectRequest] but for outgoing messages (response produced |
| 21 | | | /// by the worker). |
| 22 | | | final bool inspectResponse; |
| 23 | | | |
| 24 | | | /// Indicates whether de/serialization should use a serialization context. |
| 25 | | | /// Serialization contexts enable transfering data and preserve identities, |
| 26 | | | /// e.g. calling `myService.myMethod(x, x)` will result in the service method |
| 27 | | | /// receiving the same serialization data for `x`. If `null`, a serialization |
| 28 | | | /// context will be automatically used if and only if marshaling is required |
| 29 | | | /// to call the service method. |
| 30 | | | final bool? withContext; |
| 31 | | | } |
| 32 | | | |
| 33 | | | const squadronMethod = SquadronMethod(); |