Commit Graph

16 Commits

Author SHA1 Message Date
Maksym Pavlenko
44ca0096e1 Add comment
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-03 09:50:16 -08:00
Maksym Pavlenko
dea99e9d05 Fix handling of empty payloads
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 12:10:01 -08:00
Derek McGowan
d28bc92657 Introduce streaming to client and server
Implementation of the 1.2 protocol with support for streaming. Provides
the client and server interfaces for implementing services with
streaming.

Unary behavior is mostly unchanged and avoids extra stream tracking just
for unary calls. Streaming calls are tracked to route data to the
appropriate stream as it is received.

Stricter stream ID handling, disallowing unexpected re-use of stream
IDs.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 17:11:40 -07:00
Kazuyoshi Kato
d240c5005f Use google.golang.org/protobuf instead of github.com/gogo/protobuf
This change replaces github.com/gogo/protobuf with
google.golang.org/protobuf, except for the code generators.

All proto-encoded structs are now generated from .proto files,
which include ttrpc.Request and ttrpc.Response.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-02-16 23:11:27 +00:00
zounengren
81faa3ee80 replace pkg/errors from vendor
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-25 22:46:36 +08:00
Kazuyoshi Kato
fede9db17c Return Unimplemented when services or methods are not implemented
gRPC has UNIMPLEMENTED status code that indicates a requested method
is not implemented. However ttrpc was returning codes.NotFound which
could be returned when a request entity was not there.

This fix changes the status code from codes.NotFound to
codes.Unimplemented to disambiguate and be more compatible with gRPC.

Fixes #80.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 15:51:33 -07:00
Michael Crosby
d4834b09f5 Revert "Copy codes and status from grpc project"
This reverts commit f02233564f.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-10-28 14:46:51 -04:00
Brian Goff
923a8f1f17
Merge pull request #54 from crosbymichael/copy-grpc
Copy codes and status pkg from grpc
2019-10-28 09:48:26 -07:00
Michael Crosby
f02233564f Copy codes and status from grpc project
This copies the codes and status package from grpc as it is the only references
to the grpc project from ttrpc. This will help ensure that API breaking changes
in grpc do not affect ttrpc.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-10-28 12:33:50 -04:00
lifupan
2ef8878926 ttrpc: fix the issue of marshaling on nil will crash the server
Since some type's Marshal() on nil will crash runtime, thus
it's should check 'resp' before marshaling on it. If it's
nil, return directly to avoid the server crash.

Signed-off-by: lifupan <lifupan@gmail.com>
2019-10-24 18:48:51 +08:00
Kevin Parsons
271238abf2 Fix method full name generation
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-08-23 13:28:19 -07:00
Michael Crosby
819653f40c Add client and server unary interceptors
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-07 15:49:42 +00:00
zhoulin xie
ce5c1c4546 Fix returns error message
Signed-off-by: zhoulin xie <zhoulin.xie@daocloud.io>
2019-02-08 22:30:00 +08:00
Michael Crosby
0690b20898 Add apache license to files
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-06-27 17:49:06 -04:00
Stephen J Day
7f752bf263
ttrpc: handle concurrent requests and responses
With this changeset, ttrpc can now handle mutliple outstanding requests
and responses on the same connection without blocking. On the
server-side, we dispatch a goroutine per outstanding reequest. On the
client side, a management goroutine dispatches responses to blocked
waiters.

The protocol has been changed to support this behavior by including a
"stream id" that can used to identify which request a response belongs
to on the client-side of the connection. With these changes, we should
also be able to support streams in the future.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-21 21:38:38 -08:00
Stephen J Day
2a81659f49
ttrpc: remove use of typeurl
Rather than employ the typeurl package, we now generate code to
correctly allocate the incoming types from the caller. As a side-effect
of this activity, the services definitions have been split out into a
separate type that handles the full resolution and dispatch of the
method, incuding correctly mapping the RPC status.

This work is a pre-cursor to larger protocol change that will allow us
to handle multiple, concurrent requests.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-21 18:03:52 -08:00