starpc 0.49.20 → 0.50.0
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/dist/integration/cross-language/ts-server.js +22 -6
- package/dist/mock/index.d.ts +2 -2
- package/dist/mock/index.js +2 -2
- package/dist/rpcstream/receipt.test.d.ts +1 -0
- package/dist/rpcstream/receipt.test.js +41 -0
- package/dist/srpc/call-receipt.js +2 -1
- package/dist/srpc/call-receipt.test.js +15 -14
- package/dist/srpc/common-rpc.d.ts +1 -3
- package/dist/srpc/common-rpc.js +10 -13
- package/dist/srpc/index.d.ts +1 -1
- package/dist/srpc/index.js +1 -0
- package/dist/srpc/rpcproto.pb.d.ts +44 -0
- package/dist/srpc/rpcproto.pb.js +53 -0
- package/dist/srpc/server-invocation.d.ts +1 -1
- package/go.mod +13 -12
- package/go.sum +24 -24
- package/integration/cross-language/go-server/fixture-owner_test.go +127 -0
- package/integration/cross-language/go-server/main.go +64 -42
- package/integration/cross-language/run.bash +2 -2
- package/integration/cross-language/ts-server.ts +27 -7
- package/mock/index.ts +2 -2
- package/package.json +19 -26
- package/srpc/accept.go +1 -1
- package/srpc/call-receipt-e2e_test.go +2 -2
- package/srpc/call-receipt.go +1 -1
- package/srpc/call-receipt.test.ts +19 -16
- package/srpc/call-receipt.ts +2 -1
- package/srpc/call-receipt_test.go +19 -19
- package/srpc/common-rpc.go +6 -6
- package/srpc/common-rpc.ts +17 -16
- package/srpc/index.ts +1 -1
- package/srpc/muxed-conn.go +1 -1
- package/srpc/muxed-yamux.go +1 -1
- package/srpc/rpcproto.pb.cc +15 -4
- package/srpc/rpcproto.pb.go +96 -0
- package/srpc/rpcproto.pb.h +59 -0
- package/srpc/rpcproto.pb.rs +45 -0
- package/srpc/rpcproto.pb.ts +62 -0
- package/srpc/rpcproto.proto +16 -0
- package/srpc/schema-ownership_test.go +115 -0
- package/srpc/server-invocation.go +1 -19
- package/srpc/server-invocation.ts +1 -7
- package/srpc/stream-yamux.go +1 -1
- package/srpc/websocket.go +1 -1
|
@@ -97,7 +97,7 @@ func TestCallReceiptCommitWaitsForServerAcknowledgment(t *testing.T) {
|
|
|
97
97
|
t.Fatalf("close send count = %d, want 1", got)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
stream.terminal =
|
|
100
|
+
stream.terminal = TerminalKind_TERMINAL_KIND_COMMITTED
|
|
101
101
|
stream.terminalOkay = true
|
|
102
102
|
ack <- io.EOF
|
|
103
103
|
select {
|
|
@@ -117,7 +117,7 @@ func TestCallReceiptRejectsBareCloseAfterCloseSend(t *testing.T) {
|
|
|
117
117
|
stream := &receiptTestStream{
|
|
118
118
|
ctx: context.Background(),
|
|
119
119
|
ackErr: io.EOF,
|
|
120
|
-
terminal:
|
|
120
|
+
terminal: TerminalKind_TERMINAL_KIND_CLOSED,
|
|
121
121
|
terminalOkay: true,
|
|
122
122
|
}
|
|
123
123
|
receipt, err := ExecCallReceipt(
|
|
@@ -139,7 +139,7 @@ func TestCallReceiptCommitIgnoresCleanupError(t *testing.T) {
|
|
|
139
139
|
stream := &receiptTestStream{
|
|
140
140
|
ctx: context.Background(),
|
|
141
141
|
ackErr: io.EOF,
|
|
142
|
-
terminal:
|
|
142
|
+
terminal: TerminalKind_TERMINAL_KIND_COMMITTED,
|
|
143
143
|
terminalOkay: true,
|
|
144
144
|
closeErr: ErrCompleted,
|
|
145
145
|
}
|
|
@@ -195,7 +195,7 @@ func TestCallReceiptCommitAbortExclusion(t *testing.T) {
|
|
|
195
195
|
stream := &receiptTestStream{
|
|
196
196
|
ctx: context.Background(),
|
|
197
197
|
ackErr: io.EOF,
|
|
198
|
-
terminal:
|
|
198
|
+
terminal: TerminalKind_TERMINAL_KIND_COMMITTED,
|
|
199
199
|
terminalOkay: true,
|
|
200
200
|
}
|
|
201
201
|
receipt, err := ExecCallReceipt(
|
|
@@ -286,7 +286,7 @@ func newReceiptClient() *receiptTestClient {
|
|
|
286
286
|
stream: &receiptTestStream{
|
|
287
287
|
ctx: context.Background(),
|
|
288
288
|
ackErr: io.EOF,
|
|
289
|
-
terminal:
|
|
289
|
+
terminal: TerminalKind_TERMINAL_KIND_COMMITTED,
|
|
290
290
|
terminalOkay: true,
|
|
291
291
|
},
|
|
292
292
|
}
|
|
@@ -305,7 +305,7 @@ func TestServerInvocationTerminalClassification(t *testing.T) {
|
|
|
305
305
|
t.Fatalf("handle complete: %v", err)
|
|
306
306
|
}
|
|
307
307
|
},
|
|
308
|
-
want:
|
|
308
|
+
want: TerminalKind_TERMINAL_KIND_COMMITTED,
|
|
309
309
|
},
|
|
310
310
|
{
|
|
311
311
|
name: "cancel",
|
|
@@ -314,14 +314,14 @@ func TestServerInvocationTerminalClassification(t *testing.T) {
|
|
|
314
314
|
t.Fatalf("handle cancel: %v", err)
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
|
-
want:
|
|
317
|
+
want: TerminalKind_TERMINAL_KIND_CANCELED,
|
|
318
318
|
},
|
|
319
319
|
{
|
|
320
320
|
name: "loss",
|
|
321
321
|
act: func(rpc *ServerRPC) {
|
|
322
322
|
rpc.HandleStreamClose(errors.New("transport loss"))
|
|
323
323
|
},
|
|
324
|
-
want:
|
|
324
|
+
want: TerminalKind_TERMINAL_KIND_TRANSPORT_LOST,
|
|
325
325
|
},
|
|
326
326
|
|
|
327
327
|
{
|
|
@@ -329,7 +329,7 @@ func TestServerInvocationTerminalClassification(t *testing.T) {
|
|
|
329
329
|
act: func(rpc *ServerRPC) {
|
|
330
330
|
rpc.HandleStreamClose(context.Canceled)
|
|
331
331
|
},
|
|
332
|
-
want:
|
|
332
|
+
want: TerminalKind_TERMINAL_KIND_TRANSPORT_LOST,
|
|
333
333
|
},
|
|
334
334
|
{
|
|
335
335
|
name: "remote error packet",
|
|
@@ -338,7 +338,7 @@ func TestServerInvocationTerminalClassification(t *testing.T) {
|
|
|
338
338
|
t.Fatalf("handle remote error: %v", err)
|
|
339
339
|
}
|
|
340
340
|
},
|
|
341
|
-
want:
|
|
341
|
+
want: TerminalKind_TERMINAL_KIND_TRANSPORT_LOST,
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
344
|
name: "remote error completion packet",
|
|
@@ -350,7 +350,7 @@ func TestServerInvocationTerminalClassification(t *testing.T) {
|
|
|
350
350
|
t.Fatalf("handle remote error completion: %v", err)
|
|
351
351
|
}
|
|
352
352
|
},
|
|
353
|
-
want:
|
|
353
|
+
want: TerminalKind_TERMINAL_KIND_TRANSPORT_LOST,
|
|
354
354
|
},
|
|
355
355
|
|
|
356
356
|
{
|
|
@@ -358,7 +358,7 @@ func TestServerInvocationTerminalClassification(t *testing.T) {
|
|
|
358
358
|
act: func(rpc *ServerRPC) {
|
|
359
359
|
rpc.HandleStreamClose(nil)
|
|
360
360
|
},
|
|
361
|
-
want:
|
|
361
|
+
want: TerminalKind_TERMINAL_KIND_CLOSED,
|
|
362
362
|
},
|
|
363
363
|
}
|
|
364
364
|
for _, tc := range cases {
|
|
@@ -429,7 +429,7 @@ func TestServerInvocationTerminalIsMonotonic(t *testing.T) {
|
|
|
429
429
|
if err != nil {
|
|
430
430
|
t.Fatalf("wait terminal: %v", err)
|
|
431
431
|
}
|
|
432
|
-
if kind !=
|
|
432
|
+
if kind != TerminalKind_TERMINAL_KIND_COMMITTED {
|
|
433
433
|
t.Fatalf("terminal = %v, want committed", kind)
|
|
434
434
|
}
|
|
435
435
|
})
|
|
@@ -450,8 +450,8 @@ func TestServerInvocationGenuineAbandonment(t *testing.T) {
|
|
|
450
450
|
ownerCancel()
|
|
451
451
|
select {
|
|
452
452
|
case got := <-result:
|
|
453
|
-
if got !=
|
|
454
|
-
t.Fatalf("terminal = %v, want %v", got,
|
|
453
|
+
if got != TerminalKind_TERMINAL_KIND_ABANDONED {
|
|
454
|
+
t.Fatalf("terminal = %v, want %v", got, TerminalKind_TERMINAL_KIND_ABANDONED)
|
|
455
455
|
}
|
|
456
456
|
case <-time.After(time.Second):
|
|
457
457
|
t.Fatal("wait terminal did not return on owner cancellation")
|
|
@@ -471,7 +471,7 @@ func TestServerInvocationTerminalPrecedesOwnerCancellation(t *testing.T) {
|
|
|
471
471
|
t.Fatalf("handle complete: %v", err)
|
|
472
472
|
}
|
|
473
473
|
},
|
|
474
|
-
want:
|
|
474
|
+
want: TerminalKind_TERMINAL_KIND_COMMITTED,
|
|
475
475
|
},
|
|
476
476
|
{
|
|
477
477
|
name: "cancel",
|
|
@@ -480,21 +480,21 @@ func TestServerInvocationTerminalPrecedesOwnerCancellation(t *testing.T) {
|
|
|
480
480
|
t.Fatalf("handle cancel: %v", err)
|
|
481
481
|
}
|
|
482
482
|
},
|
|
483
|
-
want:
|
|
483
|
+
want: TerminalKind_TERMINAL_KIND_CANCELED,
|
|
484
484
|
},
|
|
485
485
|
{
|
|
486
486
|
name: "loss",
|
|
487
487
|
act: func(rpc *ServerRPC) {
|
|
488
488
|
rpc.HandleStreamClose(errors.New("transport loss"))
|
|
489
489
|
},
|
|
490
|
-
want:
|
|
490
|
+
want: TerminalKind_TERMINAL_KIND_TRANSPORT_LOST,
|
|
491
491
|
},
|
|
492
492
|
{
|
|
493
493
|
name: "bare close",
|
|
494
494
|
act: func(rpc *ServerRPC) {
|
|
495
495
|
rpc.HandleStreamClose(nil)
|
|
496
496
|
},
|
|
497
|
-
want:
|
|
497
|
+
want: TerminalKind_TERMINAL_KIND_CLOSED,
|
|
498
498
|
},
|
|
499
499
|
}
|
|
500
500
|
for _, tc := range cases {
|
package/srpc/common-rpc.go
CHANGED
|
@@ -138,7 +138,7 @@ func (c *commonRPC) WaitTerminal(ownerCtx context.Context) (TerminalKind, error)
|
|
|
138
138
|
if ownerDone {
|
|
139
139
|
err := ownerCtx.Err()
|
|
140
140
|
locked.Unlock()
|
|
141
|
-
return
|
|
141
|
+
return TerminalKind_TERMINAL_KIND_ABANDONED, err
|
|
142
142
|
}
|
|
143
143
|
waitCh := locked.WaitCh()
|
|
144
144
|
locked.Unlock()
|
|
@@ -277,11 +277,11 @@ func (c *commonRPC) HandleCallData(pkt *CallData) error {
|
|
|
277
277
|
if complete {
|
|
278
278
|
c.dataClosed = true
|
|
279
279
|
if len(pktErr) == 0 {
|
|
280
|
-
if c.recordRemoteTerminalLocked(
|
|
280
|
+
if c.recordRemoteTerminalLocked(TerminalKind_TERMINAL_KIND_COMMITTED) {
|
|
281
281
|
c.remoteCompleted = true
|
|
282
282
|
}
|
|
283
283
|
} else {
|
|
284
|
-
c.recordRemoteTerminalLocked(
|
|
284
|
+
c.recordRemoteTerminalLocked(TerminalKind_TERMINAL_KIND_TRANSPORT_LOST)
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
@@ -312,11 +312,11 @@ func (c *commonRPC) handleStreamCloseLocked(
|
|
|
312
312
|
c.remoteErr = closeErr
|
|
313
313
|
}
|
|
314
314
|
if !normalRemoteCloseAfterLocalComplete && !c.remoteTerminalSet {
|
|
315
|
-
terminal :=
|
|
315
|
+
terminal := TerminalKind_TERMINAL_KIND_CLOSED
|
|
316
316
|
if closeErr != nil {
|
|
317
|
-
terminal =
|
|
317
|
+
terminal = TerminalKind_TERMINAL_KIND_TRANSPORT_LOST
|
|
318
318
|
if c.remoteCanceled {
|
|
319
|
-
terminal =
|
|
319
|
+
terminal = TerminalKind_TERMINAL_KIND_CANCELED
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
c.recordRemoteTerminalLocked(terminal)
|
package/srpc/common-rpc.ts
CHANGED
|
@@ -3,10 +3,13 @@ import type { Sink, Source } from 'it-stream-types'
|
|
|
3
3
|
import { pushable, type Pushable } from 'it-pushable'
|
|
4
4
|
import { CompleteMessage } from '@aptre/protobuf-es-lite'
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
Packet,
|
|
8
|
+
TerminalKind,
|
|
9
|
+
type CallData,
|
|
10
|
+
type CallStart,
|
|
11
|
+
} from './rpcproto.pb.js'
|
|
8
12
|
import { ERR_RPC_ABORT, RemoteRPCError } from './errors.js'
|
|
9
|
-
import type { TerminalKind } from './server-invocation.js'
|
|
10
13
|
|
|
11
14
|
const maxBufferedOutgoingPackets = 1
|
|
12
15
|
|
|
@@ -86,7 +89,7 @@ export class CommonRPC {
|
|
|
86
89
|
const terminal = this.getTerminalKind()
|
|
87
90
|
if (terminal !== undefined) {
|
|
88
91
|
if (
|
|
89
|
-
terminal ===
|
|
92
|
+
terminal === TerminalKind.CLOSED &&
|
|
90
93
|
this.remoteSourceClosed &&
|
|
91
94
|
!this.closed
|
|
92
95
|
) {
|
|
@@ -95,7 +98,7 @@ export class CommonRPC {
|
|
|
95
98
|
return terminal
|
|
96
99
|
}
|
|
97
100
|
if (ownerAborted) {
|
|
98
|
-
return
|
|
101
|
+
return TerminalKind.ABANDONED
|
|
99
102
|
}
|
|
100
103
|
await Promise.race([this.terminalPromise, ownerDone])
|
|
101
104
|
ownerAborted = ownerSignal.aborted
|
|
@@ -267,18 +270,17 @@ export class CommonRPC {
|
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
this.pushRpcData(packet.data, packet.dataIsZero)
|
|
270
|
-
const remoteError =
|
|
271
|
-
packet.error
|
|
272
|
-
new RemoteRPCError(this.service, this.method, packet.error)
|
|
273
|
+
const remoteError = packet.error
|
|
274
|
+
? new RemoteRPCError(this.service, this.method, packet.error)
|
|
273
275
|
: undefined
|
|
274
276
|
if (remoteError) {
|
|
275
277
|
this.remoteError ??= remoteError
|
|
276
278
|
this.invocationController.abort()
|
|
277
|
-
this.recordRemoteTerminal(
|
|
279
|
+
this.recordRemoteTerminal(TerminalKind.TRANSPORT_LOST)
|
|
278
280
|
}
|
|
279
281
|
if (packet.complete && !remoteError) {
|
|
280
282
|
this.remoteCompleted = true
|
|
281
|
-
this.recordRemoteTerminal(
|
|
283
|
+
this.recordRemoteTerminal(TerminalKind.COMMITTED)
|
|
282
284
|
this._rpcDataSource.end(remoteError)
|
|
283
285
|
} else if (remoteError) {
|
|
284
286
|
this._rpcDataSource.end(remoteError)
|
|
@@ -287,7 +289,7 @@ export class CommonRPC {
|
|
|
287
289
|
|
|
288
290
|
// handleCallCancel handles a CallCancel packet.
|
|
289
291
|
public async handleCallCancel() {
|
|
290
|
-
this.recordRemoteTerminal(
|
|
292
|
+
this.recordRemoteTerminal(TerminalKind.CANCELED)
|
|
291
293
|
await this.close(new Error(ERR_RPC_ABORT))
|
|
292
294
|
}
|
|
293
295
|
|
|
@@ -300,7 +302,9 @@ export class CommonRPC {
|
|
|
300
302
|
if (!this.remoteError && err) {
|
|
301
303
|
this.remoteError = err
|
|
302
304
|
}
|
|
303
|
-
this.recordRemoteTerminal(
|
|
305
|
+
this.recordRemoteTerminal(
|
|
306
|
+
err ? TerminalKind.TRANSPORT_LOST : TerminalKind.CLOSED,
|
|
307
|
+
)
|
|
304
308
|
this.invocationController.abort()
|
|
305
309
|
// note: this does nothing if _source is already ended.
|
|
306
310
|
if (err && err.message) {
|
|
@@ -314,23 +318,20 @@ export class CommonRPC {
|
|
|
314
318
|
this._rpcDataSource.end(err)
|
|
315
319
|
}
|
|
316
320
|
|
|
317
|
-
// _createSink returns a value for the sink field.
|
|
318
321
|
private _createSink(): Sink<Source<Packet>> {
|
|
319
322
|
return async (source: Source<Packet>) => {
|
|
320
323
|
try {
|
|
321
324
|
if (Symbol.asyncIterator in source) {
|
|
322
|
-
// Handle async source
|
|
323
325
|
for await (const msg of source) {
|
|
324
326
|
await this.handlePacket(msg)
|
|
325
327
|
}
|
|
326
328
|
} else {
|
|
327
|
-
// Handle sync source
|
|
328
329
|
for (const msg of source) {
|
|
329
330
|
await this.handlePacket(msg)
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
333
|
this.remoteSourceClosed = true
|
|
333
|
-
this.recordRemoteTerminal(
|
|
334
|
+
this.recordRemoteTerminal(TerminalKind.CLOSED)
|
|
334
335
|
} catch (err) {
|
|
335
336
|
this.close(err as Error)
|
|
336
337
|
}
|
package/srpc/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { Client } from './client.js'
|
|
|
9
9
|
export { CallReceipt } from './call-receipt.js'
|
|
10
10
|
export type { HeldCall, ReceiptRpc } from './call-receipt.js'
|
|
11
11
|
export { ServerInvocation } from './server-invocation.js'
|
|
12
|
-
export
|
|
12
|
+
export { TerminalKind } from './rpcproto.pb.js'
|
|
13
13
|
export { Server } from './server.js'
|
|
14
14
|
export { StreamConn } from './conn.js'
|
|
15
15
|
export type { StreamConnParams, StreamHandler } from './conn.js'
|
package/srpc/muxed-conn.go
CHANGED
package/srpc/muxed-yamux.go
CHANGED
package/srpc/rpcproto.pb.cc
CHANGED
|
@@ -120,8 +120,8 @@ struct PacketDefaultTypeInternal {
|
|
|
120
120
|
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT
|
|
121
121
|
PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PacketDefaultTypeInternal _Packet_default_instance_;
|
|
122
122
|
} // namespace srpc
|
|
123
|
-
static
|
|
124
|
-
file_level_enum_descriptors_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto
|
|
123
|
+
static const ::_pb::EnumDescriptor* PROTOBUF_NONNULL
|
|
124
|
+
file_level_enum_descriptors_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto[1];
|
|
125
125
|
static constexpr const ::_pb::ServiceDescriptor* PROTOBUF_NONNULL* PROTOBUF_NULLABLE
|
|
126
126
|
file_level_service_descriptors_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto = nullptr;
|
|
127
127
|
const ::uint32_t
|
|
@@ -178,13 +178,18 @@ const char descriptor_table_protodef_github_2ecom_2faperturerobotics_2fstarpc_2f
|
|
|
178
178
|
"service\030\001 \001(\t\022\022\n\nrpc_method\030\002 \001(\t\022\014\n\004dat"
|
|
179
179
|
"a\030\003 \001(\014\022\024\n\014data_is_zero\030\004 \001(\010\"O\n\010CallDat"
|
|
180
180
|
"a\022\014\n\004data\030\001 \001(\014\022\024\n\014data_is_zero\030\002 \001(\010\022\020\n"
|
|
181
|
-
"\010complete\030\003 \001(\010\022\r\n\005error\030\004 \001(\
|
|
181
|
+
"\010complete\030\003 \001(\010\022\r\n\005error\030\004 \001(\t*\277\001\n\014Termi"
|
|
182
|
+
"nalKind\022\035\n\031TERMINAL_KIND_UNSPECIFIED\020\000\022\033"
|
|
183
|
+
"\n\027TERMINAL_KIND_COMMITTED\020\001\022\032\n\026TERMINAL_"
|
|
184
|
+
"KIND_CANCELED\020\002\022 \n\034TERMINAL_KIND_TRANSPO"
|
|
185
|
+
"RT_LOST\020\003\022\030\n\024TERMINAL_KIND_CLOSED\020\004\022\033\n\027T"
|
|
186
|
+
"ERMINAL_KIND_ABANDONED\020\005b\006proto3"
|
|
182
187
|
};
|
|
183
188
|
static ::absl::once_flag descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto_once;
|
|
184
189
|
PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto = {
|
|
185
190
|
false,
|
|
186
191
|
false,
|
|
187
|
-
|
|
192
|
+
552,
|
|
188
193
|
descriptor_table_protodef_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto,
|
|
189
194
|
"github.com/aperturerobotics/starpc/srpc/rpcproto.proto",
|
|
190
195
|
&descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto_once,
|
|
@@ -198,6 +203,12 @@ PROTOBUF_CONSTINIT const ::_pbi::DescriptorTable descriptor_table_github_2ecom_2
|
|
|
198
203
|
file_level_service_descriptors_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto,
|
|
199
204
|
};
|
|
200
205
|
namespace srpc {
|
|
206
|
+
const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL TerminalKind_descriptor() {
|
|
207
|
+
::google::protobuf::internal::AssignDescriptors(&descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto);
|
|
208
|
+
return file_level_enum_descriptors_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto[0];
|
|
209
|
+
}
|
|
210
|
+
PROTOBUF_CONSTINIT const uint32_t TerminalKind_internal_data_[] = {
|
|
211
|
+
393216u, 0u, };
|
|
201
212
|
// ===================================================================
|
|
202
213
|
|
|
203
214
|
class Packet::_Internal {
|
package/srpc/rpcproto.pb.go
CHANGED
|
@@ -16,6 +16,58 @@ import (
|
|
|
16
16
|
json "github.com/aperturerobotics/protobuf-go-lite/json"
|
|
17
17
|
)
|
|
18
18
|
|
|
19
|
+
// TerminalKind is the terminal state of a held unary invocation.
|
|
20
|
+
type TerminalKind int32
|
|
21
|
+
|
|
22
|
+
const (
|
|
23
|
+
// TERMINAL_KIND_UNSPECIFIED is not a valid terminal state.
|
|
24
|
+
TerminalKind_TERMINAL_KIND_UNSPECIFIED TerminalKind = 0
|
|
25
|
+
// TERMINAL_KIND_COMMITTED identifies an explicit remote CallData completion.
|
|
26
|
+
TerminalKind_TERMINAL_KIND_COMMITTED TerminalKind = 1
|
|
27
|
+
// TERMINAL_KIND_CANCELED identifies a remote CallCancel packet.
|
|
28
|
+
TerminalKind_TERMINAL_KIND_CANCELED TerminalKind = 2
|
|
29
|
+
// TERMINAL_KIND_TRANSPORT_LOST identifies a remote error or transport failure.
|
|
30
|
+
TerminalKind_TERMINAL_KIND_TRANSPORT_LOST TerminalKind = 3
|
|
31
|
+
// TERMINAL_KIND_CLOSED identifies a bare remote close without completion.
|
|
32
|
+
TerminalKind_TERMINAL_KIND_CLOSED TerminalKind = 4
|
|
33
|
+
// TERMINAL_KIND_ABANDONED identifies owner-context expiry without a remote terminal.
|
|
34
|
+
TerminalKind_TERMINAL_KIND_ABANDONED TerminalKind = 5
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
// Enum value maps for TerminalKind.
|
|
38
|
+
var (
|
|
39
|
+
TerminalKind_name = map[int32]string{
|
|
40
|
+
0: "TERMINAL_KIND_UNSPECIFIED",
|
|
41
|
+
1: "TERMINAL_KIND_COMMITTED",
|
|
42
|
+
2: "TERMINAL_KIND_CANCELED",
|
|
43
|
+
3: "TERMINAL_KIND_TRANSPORT_LOST",
|
|
44
|
+
4: "TERMINAL_KIND_CLOSED",
|
|
45
|
+
5: "TERMINAL_KIND_ABANDONED",
|
|
46
|
+
}
|
|
47
|
+
TerminalKind_value = map[string]int32{
|
|
48
|
+
"TERMINAL_KIND_UNSPECIFIED": 0,
|
|
49
|
+
"TERMINAL_KIND_COMMITTED": 1,
|
|
50
|
+
"TERMINAL_KIND_CANCELED": 2,
|
|
51
|
+
"TERMINAL_KIND_TRANSPORT_LOST": 3,
|
|
52
|
+
"TERMINAL_KIND_CLOSED": 4,
|
|
53
|
+
"TERMINAL_KIND_ABANDONED": 5,
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
func (x TerminalKind) Enum() *TerminalKind {
|
|
58
|
+
p := new(TerminalKind)
|
|
59
|
+
*p = x
|
|
60
|
+
return p
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
func (x TerminalKind) String() string {
|
|
64
|
+
name, valid := TerminalKind_name[int32(x)]
|
|
65
|
+
if valid {
|
|
66
|
+
return name
|
|
67
|
+
}
|
|
68
|
+
return strconv.Itoa(int(x))
|
|
69
|
+
}
|
|
70
|
+
|
|
19
71
|
// Packet is a message sent over a srpc packet connection.
|
|
20
72
|
type Packet struct {
|
|
21
73
|
unknownFields []byte
|
|
@@ -437,6 +489,46 @@ func (this *CallData) EqualMessageVT(thatMsg any) bool {
|
|
|
437
489
|
return this.EqualVT(that)
|
|
438
490
|
}
|
|
439
491
|
|
|
492
|
+
// MarshalProtoJSON marshals the TerminalKind to JSON.
|
|
493
|
+
func (x TerminalKind) MarshalProtoJSON(s *json.MarshalState) {
|
|
494
|
+
s.WriteEnum(int32(x), TerminalKind_name)
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// MarshalText marshals the TerminalKind to text.
|
|
498
|
+
func (x TerminalKind) MarshalText() ([]byte, error) {
|
|
499
|
+
return []byte(json.GetEnumString(int32(x), TerminalKind_name)), nil
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// MarshalJSON marshals the TerminalKind to JSON.
|
|
503
|
+
func (x TerminalKind) MarshalJSON() ([]byte, error) {
|
|
504
|
+
return json.DefaultMarshalerConfig.Marshal(x)
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// UnmarshalProtoJSON unmarshals the TerminalKind from JSON.
|
|
508
|
+
func (x *TerminalKind) UnmarshalProtoJSON(s *json.UnmarshalState) {
|
|
509
|
+
v := s.ReadEnum(TerminalKind_value)
|
|
510
|
+
if err := s.Err(); err != nil {
|
|
511
|
+
s.SetErrorf("could not read TerminalKind enum: %v", err)
|
|
512
|
+
return
|
|
513
|
+
}
|
|
514
|
+
*x = TerminalKind(v)
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// UnmarshalText unmarshals the TerminalKind from text.
|
|
518
|
+
func (x *TerminalKind) UnmarshalText(b []byte) error {
|
|
519
|
+
i, err := json.ParseEnumString(string(b), TerminalKind_value)
|
|
520
|
+
if err != nil {
|
|
521
|
+
return err
|
|
522
|
+
}
|
|
523
|
+
*x = TerminalKind(i)
|
|
524
|
+
return nil
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// UnmarshalJSON unmarshals the TerminalKind from JSON.
|
|
528
|
+
func (x *TerminalKind) UnmarshalJSON(b []byte) error {
|
|
529
|
+
return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
|
|
530
|
+
}
|
|
531
|
+
|
|
440
532
|
// MarshalProtoJSON marshals the Packet message to JSON.
|
|
441
533
|
func (x *Packet) MarshalProtoJSON(s *json.MarshalState) {
|
|
442
534
|
if x == nil {
|
|
@@ -983,6 +1075,10 @@ func (m *CallData) SizeVT() (n int) {
|
|
|
983
1075
|
return n
|
|
984
1076
|
}
|
|
985
1077
|
|
|
1078
|
+
func (x TerminalKind) MarshalProtoText() string {
|
|
1079
|
+
return x.String()
|
|
1080
|
+
}
|
|
1081
|
+
|
|
986
1082
|
func (x *Packet) MarshalProtoText() string {
|
|
987
1083
|
var sb strings.Builder
|
|
988
1084
|
sb.WriteString("Packet {")
|
package/srpc/rpcproto.pb.h
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
#include "google/protobuf/message_lite.h"
|
|
31
31
|
#include "google/protobuf/repeated_field.h" // IWYU pragma: export
|
|
32
32
|
#include "google/protobuf/extension_set.h" // IWYU pragma: export
|
|
33
|
+
#include "google/protobuf/generated_enum_reflection.h"
|
|
33
34
|
#include "google/protobuf/unknown_field_set.h"
|
|
34
35
|
// @@protoc_insertion_point(includes)
|
|
35
36
|
|
|
@@ -55,6 +56,8 @@ extern "C" {
|
|
|
55
56
|
extern const ::google::protobuf::internal::DescriptorTable descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fsrpc_2frpcproto_2eproto;
|
|
56
57
|
} // extern "C"
|
|
57
58
|
namespace srpc {
|
|
59
|
+
enum TerminalKind : int;
|
|
60
|
+
extern const uint32_t TerminalKind_internal_data_[];
|
|
58
61
|
class CallData;
|
|
59
62
|
struct CallDataDefaultTypeInternal;
|
|
60
63
|
extern CallDataDefaultTypeInternal _CallData_default_instance_;
|
|
@@ -70,10 +73,53 @@ extern const ::google::protobuf::internal::ClassDataFull Packet_class_data_;
|
|
|
70
73
|
} // namespace srpc
|
|
71
74
|
namespace google {
|
|
72
75
|
namespace protobuf {
|
|
76
|
+
template <>
|
|
77
|
+
internal::EnumTraitsT<::srpc::TerminalKind_internal_data_>
|
|
78
|
+
internal::EnumTraitsImpl::value<::srpc::TerminalKind>;
|
|
73
79
|
} // namespace protobuf
|
|
74
80
|
} // namespace google
|
|
75
81
|
|
|
76
82
|
namespace srpc {
|
|
83
|
+
enum TerminalKind : int {
|
|
84
|
+
TERMINAL_KIND_UNSPECIFIED = 0,
|
|
85
|
+
TERMINAL_KIND_COMMITTED = 1,
|
|
86
|
+
TERMINAL_KIND_CANCELED = 2,
|
|
87
|
+
TERMINAL_KIND_TRANSPORT_LOST = 3,
|
|
88
|
+
TERMINAL_KIND_CLOSED = 4,
|
|
89
|
+
TERMINAL_KIND_ABANDONED = 5,
|
|
90
|
+
TerminalKind_INT_MIN_SENTINEL_DO_NOT_USE_ =
|
|
91
|
+
::std::numeric_limits<::int32_t>::min(),
|
|
92
|
+
TerminalKind_INT_MAX_SENTINEL_DO_NOT_USE_ =
|
|
93
|
+
::std::numeric_limits<::int32_t>::max(),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
extern const uint32_t TerminalKind_internal_data_[];
|
|
97
|
+
inline constexpr TerminalKind TerminalKind_MIN =
|
|
98
|
+
static_cast<TerminalKind>(0);
|
|
99
|
+
inline constexpr TerminalKind TerminalKind_MAX =
|
|
100
|
+
static_cast<TerminalKind>(5);
|
|
101
|
+
inline bool TerminalKind_IsValid(int value) {
|
|
102
|
+
return 0 <= value && value <= 5;
|
|
103
|
+
}
|
|
104
|
+
inline constexpr int TerminalKind_ARRAYSIZE = 5 + 1;
|
|
105
|
+
const ::google::protobuf::EnumDescriptor* PROTOBUF_NONNULL TerminalKind_descriptor();
|
|
106
|
+
template <typename T>
|
|
107
|
+
const ::std::string& TerminalKind_Name(T value) {
|
|
108
|
+
static_assert(::std::is_same<T, TerminalKind>::value ||
|
|
109
|
+
::std::is_integral<T>::value,
|
|
110
|
+
"Incorrect type passed to TerminalKind_Name().");
|
|
111
|
+
return TerminalKind_Name(static_cast<TerminalKind>(value));
|
|
112
|
+
}
|
|
113
|
+
template <>
|
|
114
|
+
inline const ::std::string& TerminalKind_Name(TerminalKind value) {
|
|
115
|
+
return ::google::protobuf::internal::NameOfDenseEnum<TerminalKind_descriptor, 0, 5>(
|
|
116
|
+
static_cast<int>(value));
|
|
117
|
+
}
|
|
118
|
+
inline bool TerminalKind_Parse(
|
|
119
|
+
::absl::string_view name, TerminalKind* PROTOBUF_NONNULL value) {
|
|
120
|
+
return ::google::protobuf::internal::ParseNamedEnum<TerminalKind>(TerminalKind_descriptor(), name,
|
|
121
|
+
value);
|
|
122
|
+
}
|
|
77
123
|
|
|
78
124
|
// ===================================================================
|
|
79
125
|
|
|
@@ -1444,6 +1490,19 @@ inline void CallData::set_allocated_error(::std::string* PROTOBUF_NULLABLE value
|
|
|
1444
1490
|
} // namespace srpc
|
|
1445
1491
|
|
|
1446
1492
|
|
|
1493
|
+
namespace google {
|
|
1494
|
+
namespace protobuf {
|
|
1495
|
+
|
|
1496
|
+
template <>
|
|
1497
|
+
struct is_proto_enum<::srpc::TerminalKind> : std::true_type {};
|
|
1498
|
+
template <>
|
|
1499
|
+
inline const EnumDescriptor* PROTOBUF_NONNULL GetEnumDescriptor<::srpc::TerminalKind>() {
|
|
1500
|
+
return ::srpc::TerminalKind_descriptor();
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
} // namespace protobuf
|
|
1504
|
+
} // namespace google
|
|
1505
|
+
|
|
1447
1506
|
// @@protoc_insertion_point(global_scope)
|
|
1448
1507
|
|
|
1449
1508
|
#include "google/protobuf/port_undef.inc"
|
package/srpc/rpcproto.pb.rs
CHANGED
|
@@ -59,4 +59,49 @@ pub struct CallData {
|
|
|
59
59
|
#[prost(string, tag="4")]
|
|
60
60
|
pub error: ::prost::alloc::string::String,
|
|
61
61
|
}
|
|
62
|
+
/// TerminalKind is the terminal state of a held unary invocation.
|
|
63
|
+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
64
|
+
#[repr(i32)]
|
|
65
|
+
pub enum TerminalKind {
|
|
66
|
+
/// TERMINAL_KIND_UNSPECIFIED is not a valid terminal state.
|
|
67
|
+
Unspecified = 0,
|
|
68
|
+
/// TERMINAL_KIND_COMMITTED identifies an explicit remote CallData completion.
|
|
69
|
+
Committed = 1,
|
|
70
|
+
/// TERMINAL_KIND_CANCELED identifies a remote CallCancel packet.
|
|
71
|
+
Canceled = 2,
|
|
72
|
+
/// TERMINAL_KIND_TRANSPORT_LOST identifies a remote error or transport failure.
|
|
73
|
+
TransportLost = 3,
|
|
74
|
+
/// TERMINAL_KIND_CLOSED identifies a bare remote close without completion.
|
|
75
|
+
Closed = 4,
|
|
76
|
+
/// TERMINAL_KIND_ABANDONED identifies owner-context expiry without a remote terminal.
|
|
77
|
+
Abandoned = 5,
|
|
78
|
+
}
|
|
79
|
+
impl TerminalKind {
|
|
80
|
+
/// String value of the enum field names used in the ProtoBuf definition.
|
|
81
|
+
///
|
|
82
|
+
/// The values are not transformed in any way and thus are considered stable
|
|
83
|
+
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
84
|
+
pub fn as_str_name(&self) -> &'static str {
|
|
85
|
+
match self {
|
|
86
|
+
Self::Unspecified => "TERMINAL_KIND_UNSPECIFIED",
|
|
87
|
+
Self::Committed => "TERMINAL_KIND_COMMITTED",
|
|
88
|
+
Self::Canceled => "TERMINAL_KIND_CANCELED",
|
|
89
|
+
Self::TransportLost => "TERMINAL_KIND_TRANSPORT_LOST",
|
|
90
|
+
Self::Closed => "TERMINAL_KIND_CLOSED",
|
|
91
|
+
Self::Abandoned => "TERMINAL_KIND_ABANDONED",
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
95
|
+
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
96
|
+
match value {
|
|
97
|
+
"TERMINAL_KIND_UNSPECIFIED" => Some(Self::Unspecified),
|
|
98
|
+
"TERMINAL_KIND_COMMITTED" => Some(Self::Committed),
|
|
99
|
+
"TERMINAL_KIND_CANCELED" => Some(Self::Canceled),
|
|
100
|
+
"TERMINAL_KIND_TRANSPORT_LOST" => Some(Self::TransportLost),
|
|
101
|
+
"TERMINAL_KIND_CLOSED" => Some(Self::Closed),
|
|
102
|
+
"TERMINAL_KIND_ABANDONED" => Some(Self::Abandoned),
|
|
103
|
+
_ => None,
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
62
107
|
// @@protoc_insertion_point(module)
|