@pulsefield/protocol 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/PROTOCOL_GUIDELINES.md +123 -0
- package/Package.swift +34 -0
- package/README.md +128 -0
- package/buf.gen.yaml +13 -0
- package/buf.yaml +9 -0
- package/docs/session-scope.md +27 -0
- package/gen/python/pulsefield/protocol/py.typed +1 -0
- package/gen/python/pulsefield/protocol/v1/core_pb2.py +34 -0
- package/gen/python/pulsefield/protocol/v1/core_pb2.pyi +76 -0
- package/gen/python/pulsefield/protocol/v1/envelope_pb2.py +29 -0
- package/gen/python/pulsefield/protocol/v1/envelope_pb2.pyi +46 -0
- package/gen/python/pulsefield/protocol/v1/inference_pb2.py +48 -0
- package/gen/python/pulsefield/protocol/v1/inference_pb2.pyi +160 -0
- package/gen/python/pulsefield/protocol/v1/mapper_pb2.py +28 -0
- package/gen/python/pulsefield/protocol/v1/mapper_pb2.pyi +23 -0
- package/gen/swift/pulsefield/protocol/v1/core.pb.swift +323 -0
- package/gen/swift/pulsefield/protocol/v1/envelope.pb.swift +471 -0
- package/gen/swift/pulsefield/protocol/v1/inference.pb.swift +929 -0
- package/gen/swift/pulsefield/protocol/v1/mapper.pb.swift +143 -0
- package/package.json +59 -7
- package/proto/pulsefield/protocol/v1/core.proto +57 -0
- package/proto/pulsefield/protocol/v1/envelope.proto +49 -0
- package/proto/pulsefield/protocol/v1/inference.proto +145 -0
- package/proto/pulsefield/protocol/v1/mapper.proto +17 -0
- package/pyproject.toml +38 -0
- package/tools/check-generated.mjs +222 -0
- package/tools/check-python-package.mjs +63 -0
- package/tools/ensure-python-typed.mjs +10 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
// DO NOT EDIT.
|
|
2
|
+
// swift-format-ignore-file
|
|
3
|
+
// swiftlint:disable all
|
|
4
|
+
//
|
|
5
|
+
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
|
6
|
+
// Source: pulsefield/protocol/v1/envelope.proto
|
|
7
|
+
//
|
|
8
|
+
// For information on using the generated types, please see the documentation:
|
|
9
|
+
// https://github.com/apple/swift-protobuf/
|
|
10
|
+
|
|
11
|
+
import SwiftProtobuf
|
|
12
|
+
|
|
13
|
+
// If the compiler emits an error on this type, it is because this file
|
|
14
|
+
// was generated by a version of the `protoc` Swift plug-in that is
|
|
15
|
+
// incompatible with the version of SwiftProtobuf to which you are linking.
|
|
16
|
+
// Please ensure that you are building against the same version of the API
|
|
17
|
+
// that was used to generate this file.
|
|
18
|
+
fileprivate nonisolated struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
|
19
|
+
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
|
20
|
+
typealias Version = _2
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// Transport-agnostic binary envelope shared by Pulsefield nodes.
|
|
24
|
+
public nonisolated struct Pulsefield_Protocol_V1_Envelope: @unchecked Sendable {
|
|
25
|
+
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
|
26
|
+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
|
27
|
+
// methods supported on all messages.
|
|
28
|
+
|
|
29
|
+
/// Inference/play session identifier. Empty for node-level or graph-level messages.
|
|
30
|
+
public var sessionID: String {
|
|
31
|
+
get {_storage._sessionID}
|
|
32
|
+
set {_uniqueStorage()._sessionID = newValue}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/// Sender-local monotonic sequence number within a session. per source_node_id + session_id
|
|
36
|
+
public var sequence: UInt64 {
|
|
37
|
+
get {_storage._sequence}
|
|
38
|
+
set {_uniqueStorage()._sequence = newValue}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// Sender wall-clock timestamp in Unix milliseconds, when available.
|
|
42
|
+
public var sentAtUnixMs: Int64 {
|
|
43
|
+
get {_storage._sentAtUnixMs}
|
|
44
|
+
set {_uniqueStorage()._sentAtUnixMs = newValue}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// Node that produced this envelope, when the transport has graph identity.
|
|
48
|
+
public var sourceNodeID: String {
|
|
49
|
+
get {_storage._sourceNodeID}
|
|
50
|
+
set {_uniqueStorage()._sourceNodeID = newValue}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/// Intended recipient node. Empty means the session or transport decides routing.
|
|
54
|
+
public var targetNodeID: String {
|
|
55
|
+
get {_storage._targetNodeID}
|
|
56
|
+
set {_uniqueStorage()._targetNodeID = newValue}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// globally unique enough, sender-generated
|
|
60
|
+
public var messageID: String {
|
|
61
|
+
get {_storage._messageID}
|
|
62
|
+
set {_uniqueStorage()._messageID = newValue}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// Related message or request identifier for response and stream correlation.
|
|
66
|
+
public var correlationID: String {
|
|
67
|
+
get {_storage._correlationID}
|
|
68
|
+
set {_uniqueStorage()._correlationID = newValue}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public var payload: OneOf_Payload? {
|
|
72
|
+
get {return _storage._payload}
|
|
73
|
+
set {_uniqueStorage()._payload = newValue}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// Graph identity announcement, usually sent before domain-specific traffic.
|
|
77
|
+
public var nodeHello: Pulsefield_Protocol_V1_NodeHello {
|
|
78
|
+
get {
|
|
79
|
+
if case .nodeHello(let v)? = _storage._payload {return v}
|
|
80
|
+
return Pulsefield_Protocol_V1_NodeHello()
|
|
81
|
+
}
|
|
82
|
+
set {_uniqueStorage()._payload = .nodeHello(newValue)}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public var ready: Pulsefield_Protocol_V1_ReadyRequest {
|
|
86
|
+
get {
|
|
87
|
+
if case .ready(let v)? = _storage._payload {return v}
|
|
88
|
+
return Pulsefield_Protocol_V1_ReadyRequest()
|
|
89
|
+
}
|
|
90
|
+
set {_uniqueStorage()._payload = .ready(newValue)}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public var audio: Pulsefield_Protocol_V1_AudioRequest {
|
|
94
|
+
get {
|
|
95
|
+
if case .audio(let v)? = _storage._payload {return v}
|
|
96
|
+
return Pulsefield_Protocol_V1_AudioRequest()
|
|
97
|
+
}
|
|
98
|
+
set {_uniqueStorage()._payload = .audio(newValue)}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public var referenceTime: Pulsefield_Protocol_V1_ReferenceTimeRequest {
|
|
102
|
+
get {
|
|
103
|
+
if case .referenceTime(let v)? = _storage._payload {return v}
|
|
104
|
+
return Pulsefield_Protocol_V1_ReferenceTimeRequest()
|
|
105
|
+
}
|
|
106
|
+
set {_uniqueStorage()._payload = .referenceTime(newValue)}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public var stopSession: Pulsefield_Protocol_V1_StopSessionRequest {
|
|
110
|
+
get {
|
|
111
|
+
if case .stopSession(let v)? = _storage._payload {return v}
|
|
112
|
+
return Pulsefield_Protocol_V1_StopSessionRequest()
|
|
113
|
+
}
|
|
114
|
+
set {_uniqueStorage()._payload = .stopSession(newValue)}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/// One mapper token event. The legacy JSON transport calls this hitobject_tokens.
|
|
118
|
+
public var mapperStreamBegin: Pulsefield_Protocol_V1_MapperStreamBeginEvent {
|
|
119
|
+
get {
|
|
120
|
+
if case .mapperStreamBegin(let v)? = _storage._payload {return v}
|
|
121
|
+
return Pulsefield_Protocol_V1_MapperStreamBeginEvent()
|
|
122
|
+
}
|
|
123
|
+
set {_uniqueStorage()._payload = .mapperStreamBegin(newValue)}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public var hitObjectToken: Pulsefield_Protocol_V1_HitObjectTokenEvent {
|
|
127
|
+
get {
|
|
128
|
+
if case .hitObjectToken(let v)? = _storage._payload {return v}
|
|
129
|
+
return Pulsefield_Protocol_V1_HitObjectTokenEvent()
|
|
130
|
+
}
|
|
131
|
+
set {_uniqueStorage()._payload = .hitObjectToken(newValue)}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public var error: Pulsefield_Protocol_V1_ErrorEvent {
|
|
135
|
+
get {
|
|
136
|
+
if case .error(let v)? = _storage._payload {return v}
|
|
137
|
+
return Pulsefield_Protocol_V1_ErrorEvent()
|
|
138
|
+
}
|
|
139
|
+
set {_uniqueStorage()._payload = .error(newValue)}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public var status: Pulsefield_Protocol_V1_StatusEvent {
|
|
143
|
+
get {
|
|
144
|
+
if case .status(let v)? = _storage._payload {return v}
|
|
145
|
+
return Pulsefield_Protocol_V1_StatusEvent()
|
|
146
|
+
}
|
|
147
|
+
set {_uniqueStorage()._payload = .status(newValue)}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public var endOfStream: Pulsefield_Protocol_V1_EndOfStreamEvent {
|
|
151
|
+
get {
|
|
152
|
+
if case .endOfStream(let v)? = _storage._payload {return v}
|
|
153
|
+
return Pulsefield_Protocol_V1_EndOfStreamEvent()
|
|
154
|
+
}
|
|
155
|
+
set {_uniqueStorage()._payload = .endOfStream(newValue)}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
|
159
|
+
|
|
160
|
+
public nonisolated enum OneOf_Payload: Equatable, Sendable {
|
|
161
|
+
/// Graph identity announcement, usually sent before domain-specific traffic.
|
|
162
|
+
case nodeHello(Pulsefield_Protocol_V1_NodeHello)
|
|
163
|
+
case ready(Pulsefield_Protocol_V1_ReadyRequest)
|
|
164
|
+
case audio(Pulsefield_Protocol_V1_AudioRequest)
|
|
165
|
+
case referenceTime(Pulsefield_Protocol_V1_ReferenceTimeRequest)
|
|
166
|
+
case stopSession(Pulsefield_Protocol_V1_StopSessionRequest)
|
|
167
|
+
/// One mapper token event. The legacy JSON transport calls this hitobject_tokens.
|
|
168
|
+
case mapperStreamBegin(Pulsefield_Protocol_V1_MapperStreamBeginEvent)
|
|
169
|
+
case hitObjectToken(Pulsefield_Protocol_V1_HitObjectTokenEvent)
|
|
170
|
+
case error(Pulsefield_Protocol_V1_ErrorEvent)
|
|
171
|
+
case status(Pulsefield_Protocol_V1_StatusEvent)
|
|
172
|
+
case endOfStream(Pulsefield_Protocol_V1_EndOfStreamEvent)
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public init() {}
|
|
177
|
+
|
|
178
|
+
fileprivate var _storage = _StorageClass.defaultInstance
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
|
182
|
+
|
|
183
|
+
fileprivate nonisolated let _protobuf_package = "pulsefield.protocol.v1"
|
|
184
|
+
|
|
185
|
+
nonisolated extension Pulsefield_Protocol_V1_Envelope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
|
186
|
+
public static let protoMessageName: String = _protobuf_package + ".Envelope"
|
|
187
|
+
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}session_id\0\u{1}sequence\0\u{3}sent_at_unix_ms\0\u{3}source_node_id\0\u{3}target_node_id\0\u{3}message_id\0\u{3}correlation_id\0\u{3}node_hello\0\u{2}\u{2}ready\0\u{1}audio\0\u{3}reference_time\0\u{3}stop_session\0\u{4}\u{6}mapper_stream_begin\0\u{3}hit_object_token\0\u{1}error\0\u{1}status\0\u{3}end_of_stream\0")
|
|
188
|
+
|
|
189
|
+
fileprivate class _StorageClass {
|
|
190
|
+
var _sessionID: String = String()
|
|
191
|
+
var _sequence: UInt64 = 0
|
|
192
|
+
var _sentAtUnixMs: Int64 = 0
|
|
193
|
+
var _sourceNodeID: String = String()
|
|
194
|
+
var _targetNodeID: String = String()
|
|
195
|
+
var _messageID: String = String()
|
|
196
|
+
var _correlationID: String = String()
|
|
197
|
+
var _payload: Pulsefield_Protocol_V1_Envelope.OneOf_Payload?
|
|
198
|
+
|
|
199
|
+
// This property is used as the initial default value for new instances of the type.
|
|
200
|
+
// The type itself is protecting the reference to its storage via CoW semantics.
|
|
201
|
+
// This will force a copy to be made of this reference when the first mutation occurs;
|
|
202
|
+
// hence, it is safe to mark this as `nonisolated(unsafe)`.
|
|
203
|
+
static nonisolated(unsafe) let defaultInstance = _StorageClass()
|
|
204
|
+
|
|
205
|
+
private init() {}
|
|
206
|
+
|
|
207
|
+
init(copying source: _StorageClass) {
|
|
208
|
+
_sessionID = source._sessionID
|
|
209
|
+
_sequence = source._sequence
|
|
210
|
+
_sentAtUnixMs = source._sentAtUnixMs
|
|
211
|
+
_sourceNodeID = source._sourceNodeID
|
|
212
|
+
_targetNodeID = source._targetNodeID
|
|
213
|
+
_messageID = source._messageID
|
|
214
|
+
_correlationID = source._correlationID
|
|
215
|
+
_payload = source._payload
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
fileprivate mutating func _uniqueStorage() -> _StorageClass {
|
|
220
|
+
if !isKnownUniquelyReferenced(&_storage) {
|
|
221
|
+
_storage = _StorageClass(copying: _storage)
|
|
222
|
+
}
|
|
223
|
+
return _storage
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
|
227
|
+
_ = _uniqueStorage()
|
|
228
|
+
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
|
229
|
+
while let fieldNumber = try decoder.nextFieldNumber() {
|
|
230
|
+
// The use of inline closures is to circumvent an issue where the compiler
|
|
231
|
+
// allocates stack space for every case branch when no optimizations are
|
|
232
|
+
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
|
233
|
+
switch fieldNumber {
|
|
234
|
+
case 1: try { try decoder.decodeSingularStringField(value: &_storage._sessionID) }()
|
|
235
|
+
case 2: try { try decoder.decodeSingularUInt64Field(value: &_storage._sequence) }()
|
|
236
|
+
case 3: try { try decoder.decodeSingularInt64Field(value: &_storage._sentAtUnixMs) }()
|
|
237
|
+
case 4: try { try decoder.decodeSingularStringField(value: &_storage._sourceNodeID) }()
|
|
238
|
+
case 5: try { try decoder.decodeSingularStringField(value: &_storage._targetNodeID) }()
|
|
239
|
+
case 6: try { try decoder.decodeSingularStringField(value: &_storage._messageID) }()
|
|
240
|
+
case 7: try { try decoder.decodeSingularStringField(value: &_storage._correlationID) }()
|
|
241
|
+
case 8: try {
|
|
242
|
+
var v: Pulsefield_Protocol_V1_NodeHello?
|
|
243
|
+
var hadOneofValue = false
|
|
244
|
+
if let current = _storage._payload {
|
|
245
|
+
hadOneofValue = true
|
|
246
|
+
if case .nodeHello(let m) = current {v = m}
|
|
247
|
+
}
|
|
248
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
249
|
+
if let v = v {
|
|
250
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
251
|
+
_storage._payload = .nodeHello(v)
|
|
252
|
+
}
|
|
253
|
+
}()
|
|
254
|
+
case 10: try {
|
|
255
|
+
var v: Pulsefield_Protocol_V1_ReadyRequest?
|
|
256
|
+
var hadOneofValue = false
|
|
257
|
+
if let current = _storage._payload {
|
|
258
|
+
hadOneofValue = true
|
|
259
|
+
if case .ready(let m) = current {v = m}
|
|
260
|
+
}
|
|
261
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
262
|
+
if let v = v {
|
|
263
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
264
|
+
_storage._payload = .ready(v)
|
|
265
|
+
}
|
|
266
|
+
}()
|
|
267
|
+
case 11: try {
|
|
268
|
+
var v: Pulsefield_Protocol_V1_AudioRequest?
|
|
269
|
+
var hadOneofValue = false
|
|
270
|
+
if let current = _storage._payload {
|
|
271
|
+
hadOneofValue = true
|
|
272
|
+
if case .audio(let m) = current {v = m}
|
|
273
|
+
}
|
|
274
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
275
|
+
if let v = v {
|
|
276
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
277
|
+
_storage._payload = .audio(v)
|
|
278
|
+
}
|
|
279
|
+
}()
|
|
280
|
+
case 12: try {
|
|
281
|
+
var v: Pulsefield_Protocol_V1_ReferenceTimeRequest?
|
|
282
|
+
var hadOneofValue = false
|
|
283
|
+
if let current = _storage._payload {
|
|
284
|
+
hadOneofValue = true
|
|
285
|
+
if case .referenceTime(let m) = current {v = m}
|
|
286
|
+
}
|
|
287
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
288
|
+
if let v = v {
|
|
289
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
290
|
+
_storage._payload = .referenceTime(v)
|
|
291
|
+
}
|
|
292
|
+
}()
|
|
293
|
+
case 13: try {
|
|
294
|
+
var v: Pulsefield_Protocol_V1_StopSessionRequest?
|
|
295
|
+
var hadOneofValue = false
|
|
296
|
+
if let current = _storage._payload {
|
|
297
|
+
hadOneofValue = true
|
|
298
|
+
if case .stopSession(let m) = current {v = m}
|
|
299
|
+
}
|
|
300
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
301
|
+
if let v = v {
|
|
302
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
303
|
+
_storage._payload = .stopSession(v)
|
|
304
|
+
}
|
|
305
|
+
}()
|
|
306
|
+
case 19: try {
|
|
307
|
+
var v: Pulsefield_Protocol_V1_MapperStreamBeginEvent?
|
|
308
|
+
var hadOneofValue = false
|
|
309
|
+
if let current = _storage._payload {
|
|
310
|
+
hadOneofValue = true
|
|
311
|
+
if case .mapperStreamBegin(let m) = current {v = m}
|
|
312
|
+
}
|
|
313
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
314
|
+
if let v = v {
|
|
315
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
316
|
+
_storage._payload = .mapperStreamBegin(v)
|
|
317
|
+
}
|
|
318
|
+
}()
|
|
319
|
+
case 20: try {
|
|
320
|
+
var v: Pulsefield_Protocol_V1_HitObjectTokenEvent?
|
|
321
|
+
var hadOneofValue = false
|
|
322
|
+
if let current = _storage._payload {
|
|
323
|
+
hadOneofValue = true
|
|
324
|
+
if case .hitObjectToken(let m) = current {v = m}
|
|
325
|
+
}
|
|
326
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
327
|
+
if let v = v {
|
|
328
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
329
|
+
_storage._payload = .hitObjectToken(v)
|
|
330
|
+
}
|
|
331
|
+
}()
|
|
332
|
+
case 21: try {
|
|
333
|
+
var v: Pulsefield_Protocol_V1_ErrorEvent?
|
|
334
|
+
var hadOneofValue = false
|
|
335
|
+
if let current = _storage._payload {
|
|
336
|
+
hadOneofValue = true
|
|
337
|
+
if case .error(let m) = current {v = m}
|
|
338
|
+
}
|
|
339
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
340
|
+
if let v = v {
|
|
341
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
342
|
+
_storage._payload = .error(v)
|
|
343
|
+
}
|
|
344
|
+
}()
|
|
345
|
+
case 22: try {
|
|
346
|
+
var v: Pulsefield_Protocol_V1_StatusEvent?
|
|
347
|
+
var hadOneofValue = false
|
|
348
|
+
if let current = _storage._payload {
|
|
349
|
+
hadOneofValue = true
|
|
350
|
+
if case .status(let m) = current {v = m}
|
|
351
|
+
}
|
|
352
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
353
|
+
if let v = v {
|
|
354
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
355
|
+
_storage._payload = .status(v)
|
|
356
|
+
}
|
|
357
|
+
}()
|
|
358
|
+
case 23: try {
|
|
359
|
+
var v: Pulsefield_Protocol_V1_EndOfStreamEvent?
|
|
360
|
+
var hadOneofValue = false
|
|
361
|
+
if let current = _storage._payload {
|
|
362
|
+
hadOneofValue = true
|
|
363
|
+
if case .endOfStream(let m) = current {v = m}
|
|
364
|
+
}
|
|
365
|
+
try decoder.decodeSingularMessageField(value: &v)
|
|
366
|
+
if let v = v {
|
|
367
|
+
if hadOneofValue {try decoder.handleConflictingOneOf()}
|
|
368
|
+
_storage._payload = .endOfStream(v)
|
|
369
|
+
}
|
|
370
|
+
}()
|
|
371
|
+
default: break
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
|
378
|
+
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
|
|
379
|
+
// The use of inline closures is to circumvent an issue where the compiler
|
|
380
|
+
// allocates stack space for every if/case branch local when no optimizations
|
|
381
|
+
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
|
|
382
|
+
// https://github.com/apple/swift-protobuf/issues/1182
|
|
383
|
+
if !_storage._sessionID.isEmpty {
|
|
384
|
+
try visitor.visitSingularStringField(value: _storage._sessionID, fieldNumber: 1)
|
|
385
|
+
}
|
|
386
|
+
if _storage._sequence != 0 {
|
|
387
|
+
try visitor.visitSingularUInt64Field(value: _storage._sequence, fieldNumber: 2)
|
|
388
|
+
}
|
|
389
|
+
if _storage._sentAtUnixMs != 0 {
|
|
390
|
+
try visitor.visitSingularInt64Field(value: _storage._sentAtUnixMs, fieldNumber: 3)
|
|
391
|
+
}
|
|
392
|
+
if !_storage._sourceNodeID.isEmpty {
|
|
393
|
+
try visitor.visitSingularStringField(value: _storage._sourceNodeID, fieldNumber: 4)
|
|
394
|
+
}
|
|
395
|
+
if !_storage._targetNodeID.isEmpty {
|
|
396
|
+
try visitor.visitSingularStringField(value: _storage._targetNodeID, fieldNumber: 5)
|
|
397
|
+
}
|
|
398
|
+
if !_storage._messageID.isEmpty {
|
|
399
|
+
try visitor.visitSingularStringField(value: _storage._messageID, fieldNumber: 6)
|
|
400
|
+
}
|
|
401
|
+
if !_storage._correlationID.isEmpty {
|
|
402
|
+
try visitor.visitSingularStringField(value: _storage._correlationID, fieldNumber: 7)
|
|
403
|
+
}
|
|
404
|
+
switch _storage._payload {
|
|
405
|
+
case .nodeHello?: try {
|
|
406
|
+
guard case .nodeHello(let v)? = _storage._payload else { preconditionFailure() }
|
|
407
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
|
|
408
|
+
}()
|
|
409
|
+
case .ready?: try {
|
|
410
|
+
guard case .ready(let v)? = _storage._payload else { preconditionFailure() }
|
|
411
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
|
|
412
|
+
}()
|
|
413
|
+
case .audio?: try {
|
|
414
|
+
guard case .audio(let v)? = _storage._payload else { preconditionFailure() }
|
|
415
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 11)
|
|
416
|
+
}()
|
|
417
|
+
case .referenceTime?: try {
|
|
418
|
+
guard case .referenceTime(let v)? = _storage._payload else { preconditionFailure() }
|
|
419
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 12)
|
|
420
|
+
}()
|
|
421
|
+
case .stopSession?: try {
|
|
422
|
+
guard case .stopSession(let v)? = _storage._payload else { preconditionFailure() }
|
|
423
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 13)
|
|
424
|
+
}()
|
|
425
|
+
case .mapperStreamBegin?: try {
|
|
426
|
+
guard case .mapperStreamBegin(let v)? = _storage._payload else { preconditionFailure() }
|
|
427
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
|
|
428
|
+
}()
|
|
429
|
+
case .hitObjectToken?: try {
|
|
430
|
+
guard case .hitObjectToken(let v)? = _storage._payload else { preconditionFailure() }
|
|
431
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 20)
|
|
432
|
+
}()
|
|
433
|
+
case .error?: try {
|
|
434
|
+
guard case .error(let v)? = _storage._payload else { preconditionFailure() }
|
|
435
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 21)
|
|
436
|
+
}()
|
|
437
|
+
case .status?: try {
|
|
438
|
+
guard case .status(let v)? = _storage._payload else { preconditionFailure() }
|
|
439
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 22)
|
|
440
|
+
}()
|
|
441
|
+
case .endOfStream?: try {
|
|
442
|
+
guard case .endOfStream(let v)? = _storage._payload else { preconditionFailure() }
|
|
443
|
+
try visitor.visitSingularMessageField(value: v, fieldNumber: 23)
|
|
444
|
+
}()
|
|
445
|
+
case nil: break
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
try unknownFields.traverse(visitor: &visitor)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
public static func ==(lhs: Pulsefield_Protocol_V1_Envelope, rhs: Pulsefield_Protocol_V1_Envelope) -> Bool {
|
|
452
|
+
if lhs._storage !== rhs._storage {
|
|
453
|
+
let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
|
|
454
|
+
let _storage = _args.0
|
|
455
|
+
let rhs_storage = _args.1
|
|
456
|
+
if _storage._sessionID != rhs_storage._sessionID {return false}
|
|
457
|
+
if _storage._sequence != rhs_storage._sequence {return false}
|
|
458
|
+
if _storage._sentAtUnixMs != rhs_storage._sentAtUnixMs {return false}
|
|
459
|
+
if _storage._sourceNodeID != rhs_storage._sourceNodeID {return false}
|
|
460
|
+
if _storage._targetNodeID != rhs_storage._targetNodeID {return false}
|
|
461
|
+
if _storage._messageID != rhs_storage._messageID {return false}
|
|
462
|
+
if _storage._correlationID != rhs_storage._correlationID {return false}
|
|
463
|
+
if _storage._payload != rhs_storage._payload {return false}
|
|
464
|
+
return true
|
|
465
|
+
}
|
|
466
|
+
if !storagesAreEqual {return false}
|
|
467
|
+
}
|
|
468
|
+
if lhs.unknownFields != rhs.unknownFields {return false}
|
|
469
|
+
return true
|
|
470
|
+
}
|
|
471
|
+
}
|