-
Notifications
You must be signed in to change notification settings - Fork 154
Proposal v2 #951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Proposal v2 #951
Changes from 8 commits
d3bc2e5
645a7ea
ef6a34b
115cba7
85fc672
b000522
173c98b
fc8db53
0e78813
011e856
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,4 +35,4 @@ jobs: | |
| shell: bash | ||
| run: | | ||
| go build ./... | ||
| go test -vet=off -race ./... | ||
| go test -vet=off -timeout 30m ./... | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ on [connectrpc.com][docs] (especially the [Getting Started] guide for Go), the | |
|
|
||
| Curious what all this looks like in practice? From a [Protobuf | ||
| schema](internal/proto/connect/ping/v1/ping.proto), we generate [a small RPC | ||
| package](internal/gen/simple/connect/ping/v1/pingv1connect/ping.connect.go). Using that | ||
| package](internal/gen/connect/ping/v1/pingv1connect/ping.connect.go). Using that | ||
| package, we can build a server. This example is available at [internal/example](internal/example): | ||
|
|
||
| ```go | ||
|
|
@@ -63,10 +63,11 @@ import ( | |
| "log" | ||
| "net/http" | ||
|
|
||
| "connectrpc.com/connect" | ||
| pingv1 "connectrpc.com/connect/internal/gen/connect/ping/v1" | ||
| "connectrpc.com/connect/internal/gen/simple/connect/ping/v1/pingv1connect" | ||
| "connectrpc.com/validate" | ||
| "connectrpc.com/connect/v2" | ||
| "connectrpc.com/connect/v2/connecthttp" | ||
| pingv1 "connectrpc.com/connect/v2/internal/gen/connect/ping/v1" | ||
| "connectrpc.com/connect/v2/internal/gen/connect/ping/v1/pingv1connect" | ||
| "connectrpc.com/validate/v2" | ||
| ) | ||
|
|
||
| type PingServer struct { | ||
|
|
@@ -80,16 +81,13 @@ func (ps *PingServer) Ping(ctx context.Context, req *pingv1.PingRequest) (*pingv | |
| } | ||
|
|
||
| func main() { | ||
| // Register services on a *connect.Server, then mount it with connecthttp. | ||
| // Interceptors are arguments to NewServer. Validation via Protovalidate is | ||
| // almost always recommended. | ||
| server := connect.NewServer(validate.NewServerInterceptor()) | ||
| pingv1connect.RegisterPingServiceHandler(server, &PingServer{}) | ||
| mux := http.NewServeMux() | ||
| // The generated constructors return a path and a plain net/http | ||
| // handler. | ||
| mux.Handle( | ||
| pingv1connect.NewPingServiceHandler( | ||
| &PingServer{}, | ||
| // Validation via Protovalidate is almost always recommended | ||
| connect.WithInterceptors(validate.NewInterceptor()), | ||
| ), | ||
| ) | ||
| connecthttp.Mount(mux, server) | ||
| p := new(http.Protocols) | ||
| p.SetHTTP1(true) | ||
| // For gRPC clients, it's convenient to support HTTP/2 without TLS. | ||
|
|
@@ -116,17 +114,19 @@ import ( | |
| "log" | ||
| "net/http" | ||
|
|
||
| pingv1 "connectrpc.com/connect/internal/gen/connect/ping/v1" | ||
| "connectrpc.com/connect/internal/gen/simple/connect/ping/v1/pingv1connect" | ||
| "connectrpc.com/connect/v2" | ||
| "connectrpc.com/connect/v2/connecthttp" | ||
| pingv1 "connectrpc.com/connect/v2/internal/gen/connect/ping/v1" | ||
| "connectrpc.com/connect/v2/internal/gen/connect/ping/v1/pingv1connect" | ||
| ) | ||
|
|
||
| func main() { | ||
| client := pingv1connect.NewPingServiceClient( | ||
| http.DefaultClient, | ||
| "http://localhost:8080/", | ||
| client := connect.NewClient( | ||
| connecthttp.NewTransport(http.DefaultClient, "http://localhost:8080"), | ||
| ) | ||
| pingClient := pingv1connect.NewPingServiceClient(client) | ||
| req := &pingv1.PingRequest{Number: 42} | ||
| res, err := client.Ping(context.Background(), req) | ||
| res, err := pingClient.Ping(context.Background(), req) | ||
| if err != nil { | ||
| log.Fatalln(err) | ||
| } | ||
|
|
@@ -138,6 +138,13 @@ Of course, `http.ListenAndServe` and `http.DefaultClient` aren't fit for | |
| production use! See Connect's [deployment docs][docs-deployment] for a guide to | ||
| configuring timeouts, connection pools, observability, and h2c. | ||
|
|
||
| ## Migrating from v1 | ||
|
|
||
| If you are migrating from v1 to v2, check out our [migration guide](./docs/v2-migration.md). | ||
|
|
||
| This project follows semantic versioning. The module `/v2` suffix is part of | ||
| the module `connectrpc.com/connect/v2`. | ||
|
|
||
| ## Ecosystem | ||
|
|
||
| * [grpchealth]: gRPC-compatible health checks for connect-go | ||
|
|
@@ -148,16 +155,24 @@ configuring timeouts, connection pools, observability, and h2c. | |
| * [Buf Studio]: web UI for ad-hoc RPCs | ||
| * [conformance]: Connect, gRPC, and gRPC-Web interoperability tests | ||
|
|
||
| ## Status: Stable | ||
| ## Status | ||
|
|
||
| This module is stable. It supports: | ||
| This module, `connectrpc.com/connect/v2`, is in beta. | ||
| The `v2` module will be published on the `main` branch of the repository when released. | ||
|
Comment on lines
+160
to
+161
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit unclear to me what that means. Is the plan to merge this branch to main and maintain v1 in a v1 branch, or to keep the v2 branch going until a stable release? I believe that merging to main is more user-friendly because the docs and migration guide are easier to discover. RELEASE.md still references v1.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intent is to merge v2 to main and create a v1 branch to maintain v1. The first release will be |
||
|
|
||
| ## Support and versioning | ||
|
|
||
| `connect-go` supports: | ||
|
|
||
| * The two most recent major releases of Go (the same versions of Go that continue | ||
| to [receive security patches][go-support-policy]). | ||
| * [APIv2] of Protocol Buffers in Go (`google.golang.org/protobuf`). | ||
|
|
||
| Within those parameters, `connect` follows semantic versioning. We will | ||
| _not_ make breaking changes in the 1.x series of releases. | ||
| Within those parameters, `connect-go` follows semantic versioning. | ||
|
|
||
| Module `connectrpc.com/connect` is the `v1` module. It remains stable and | ||
| supported indefinitely. The `v1` module lives on the `v1` branch. | ||
| See the [v2 guide](docs/v2-guide.md) for an overview of what changed and why. | ||
|
|
||
| ## Legal | ||
|
|
||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.