Commit Graph

184 Commits

Author SHA1 Message Date
Derek McGowan
6f33ccebed Update protocol for closed data messages
Add flag to indicate that a data message used with a close flag
is not sending any data. This clears up any ambiguity over whether the
final data message is transmitting a zero length data message or no
data at all.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 17:11:40 -07:00
Derek McGowan
38c2a67905 Add integration test to github actions
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 17:11:40 -07:00
Derek McGowan
84187a847b Add integration test package
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 17:11:40 -07:00
Derek McGowan
a323535118 Add streaming support to go-ttrpc generator
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 17:11:40 -07:00
Derek McGowan
86d3c77a60 Add stream tests
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 17:11:40 -07: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
Derek McGowan
bc84c40744
Merge pull request #109 from dmcgowan/update-gha
Update checkout and lint actions
2022-04-07 17:10:56 -07:00
Derek McGowan
ff1e359daa Update checkout and lint actions
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-07 11:56:32 -07:00
Phil Estes
b194a107f3
Merge pull request #106 from dmcgowan/update-protobuf-process
Add Makefile and update protobuf
2022-03-07 12:59:15 -05:00
Derek McGowan
f8e8cc43e6 Server test show sys error
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-03-04 18:17:11 -08:00
Derek McGowan
99a30d2437 Update github actions ci to use Makefile
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-03-04 18:17:11 -08:00
Derek McGowan
fe03193c28 Add makefile and update protoc version
Use makefile and installation script for protoc.
Update protoc version to match containerd.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-03-04 18:17:11 -08:00
Derek McGowan
cefcdeb31a
Merge pull request #102 from dmcgowan/protocol-definition
Add ttrpc protocol definition
2022-03-03 12:43:42 -08:00
Derek McGowan
30684b0d8e Add ttrpc protocol definition
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-03-02 11:42:10 -08:00
Derek McGowan
aa5c94700b
Merge pull request #105 from kzys/codecov
Enable Codecov again
2022-02-22 13:02:45 -08:00
Kazuyoshi Kato
79bcb78818 Enable Codecov again
We have lost Codecov since #101. While the main containerd repository
doesn't have that, ttrpc could have Codecov without much complications.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-02-22 18:12:17 +00:00
Derek McGowan
e35aa966f7
Merge pull request #103 from kzys/fix-windows-lint
Use CR+LF instead of LF regardless of OS
2022-02-22 09:45:16 -08:00
Kazuyoshi Kato
8fe1bd5ef2 Use CR+LF instead of LF regardless of OS
Git by default uses CR+LF on Windows, whereas gofmt always
uses LF even on Windows.

This commit lets Git uses LF on Windows.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-02-21 23:47:19 +00:00
Derek McGowan
40a76139bd
Merge pull request #104 from kzys/windows-wsarecv
Log the error's underyling errno if there is
2022-02-21 14:00:17 -08:00
Kazuyoshi Kato
44dfd7fdbd Log the error's underyling errno if there is
This test occasionally fails on Windows. This commit logs extra
information about the error to understand the situation better.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-02-21 21:33:56 +00:00
Derek McGowan
c636d0d1aa
Merge pull request #99 from kzys/bye-gogo
Use google.golang.org/protobuf instead of github.com/gogo/protobuf
2022-02-16 15:35:33 -08: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
Derek McGowan
332f4c9a9b
Merge pull request #100 from tklauser/ucred-wrap-err
Wrap correct error on unix.GetsockoptUcred failure
2022-01-21 15:00:05 -08:00
Derek McGowan
a362a1377f
Merge pull request #101 from dmcgowan/update-ci
Update CI project checks to use containerd project action
2022-01-21 14:56:20 -08:00
Derek McGowan
ad4afc0343 Update to latest os for build and test
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-21 12:15:17 -08:00
Derek McGowan
f7a2e09ef8 Fix lint issues
Cleanup server test

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-21 12:04:30 -08:00
Derek McGowan
9858689671 Update CI project checks to use containerd project action
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-20 14:43:04 -08:00
Tobias Klauser
5b394b91bd
Wrap correct error on unix.GetsockoptUcred failure
Wrap ucredErr which is set by unix.GetsockoptUcred, not the nil err.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-01-11 20:03:32 +01:00
Phil Estes
0247db16a1
Merge pull request #96 from kzys/new-codegen
Add protoc-gen-go-ttrpc
2021-11-08 13:05:39 -08:00
Derek McGowan
d2d6bb6f89
Merge pull request #94 from kevpar/deadlock-new
client: Handle sending/receiving in separate goroutines
2021-10-29 17:48:08 -07:00
Kazuyoshi Kato
6eabacc9bc Add protoc-gen-go-ttrpc
Google's new protobuf code generator only supports protobuf
serialization/deserialization and let other code generators handle
RPC-related aspects.

This new code generator follows the change and can be used with
the new protobuf code generator.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-10-26 10:03:23 -07:00
Phil Estes
58eb91eddb
Merge pull request #95 from kzys/gha-protobuild
Run Protobuild in GitHub Actions
2021-10-26 11:26:33 -04:00
Kazuyoshi Kato
e621cd13e4 Run Protobuild in GitHub Actions
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-10-25 18:37:10 -07:00
Kazuyoshi Kato
35cd24038a Re-generate example.pb.go
It is different from what this repository would generate, probably
since 7c78be300b.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-10-25 18:37:10 -07:00
Kevin Parsons
4f0aeb590b client: Handle sending/receiving in separate goroutines
Changes the TTRPC client logic so that sending and receiving with the
server are in completely independent goroutines, with shared state
guarded by a mutex. Previously, sending/receiving were tied together by
reliance on a coordinator goroutine. This led to issues where if the
server was not reading from the connection, the client could get stuck
sending a request, causing the client to not read responses from the
server. See [1] for more details.

The new design sets up separate sending/receiving goroutines. These
share state in the form of the set of active calls that have been made
to the server. This state is encapsulated in the callMap type and access
is guarded by a mutex.

The main event loop in `run` previously handled a lot of state
management for the client. Now that most state is tracked by the
callMap, it mostly exists to notice when the client is closed and take
appropriate action to clean up.

Also did some minor code cleanup. For instance, the code was previously
written to support multiple receiver goroutines, though this was not
actually used. I've removed this for now, since the code is simpler this
way, and it's easy to add back if we actually need it in the future.

[1] https://github.com/containerd/ttrpc/issues/72

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2021-10-13 17:31:34 -07:00
Fu Wei
77fc8a41aa
Merge pull request #93 from zoues/replaceerror 2021-09-26 22:51:06 +08:00
zounengren
81faa3ee80 replace pkg/errors from vendor
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-25 22:46:36 +08:00
Fu Wei
360e86c9dd
Merge pull request #86 from dmcgowan/branch-rename 2021-06-19 14:57:08 +08:00
Derek McGowan
a1433112ec Rename branch from master to main
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-06-18 23:53:03 -07:00
Derek McGowan
b649452727
Merge pull request #85 from kzys/non-linux
Make "go test" and "go build" work on macOS
2021-05-24 15:27:06 -07:00
Phil Estes
33729c89b3
Merge pull request #83 from kzys/unimplemented
Return Unimplemented when services or methods are not implemented
2021-05-24 12:24:54 -04:00
Fu Wei
06c1124f7e
Merge pull request #84 from kzys/not-new
Remove "Very new" and checked TODO items
2021-05-23 08:48:26 +08:00
Kazuyoshi Kato
236899069c Make the example command buildable on macOS
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 17:13:14 -07:00
Kazuyoshi Kato
616d54c531 Run GitHub Actions on macOS
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 17:04:36 -07:00
Kazuyoshi Kato
a4b18e0db8 Make "go test" work on macOS
Abstract sockets, procfs and unix.Ucred are only available on Linux.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 16:58:39 -07:00
Kazuyoshi Kato
dcc7d39848 Remove "Very new" and checked TODO items
ttrpc is not new. It has been used by containerd for years.

Fixes #59.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-05-21 15:55:17 -07: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
Akihiro Suda
25f5476b0b
Merge pull request #82 from containerd/remove-unused-gitignore
removing glide from ignore
2021-05-07 05:30:58 +09:00
Mike Brown
2776d3f857 removing glide from ignore
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2021-05-06 14:04:24 -05:00
Phil Estes
9191ec94bb
Merge pull request #79 from thaJeztah/bump_deps
go.mod: update dependencies
2021-03-16 08:20:54 -04:00