Skip to content

Commit

Permalink
release v1.1.0 (#141)
Browse files Browse the repository at this point in the history
Release v1.1.0
  • Loading branch information
sandyskies authored Nov 30, 2023
2 parents 51b2ec9 + edc1105 commit ddf95ed
Show file tree
Hide file tree
Showing 59 changed files with 770 additions and 1,496 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/02-question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Questions
about: questions or inquiries about the project
title: "question: affected/package: "
labels: question
---

### Preliminary Research

<!--
Please confirm the following before submitting your issue. Thanks!
-->

- [ ] I have read the project's documentation.
- [ ] I have searched [existing issues](https://github.com/trpc-group/trpc-go/issues) for similar questions to see if my question has already been addressed.

### Question

<!--
Ask your question or describe the issue you're facing. Be as clear and concise as possible.
-->

### Additional Information

<!--
If applicable, provide any additional information that may help clarify your question or inquiry.
-->
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/03-proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
name: Proposals
about: New external API or other notable changes
title: "proposal: affected/package: "
labels: Proposal
labels: proposal
---

<!--
Our proposal process is documented here:
todo
https://github.com/trpc-group/trpc/tree/main/proposal
-->
40 changes: 40 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- Thanks for your PR, you're awesome! 👍
Please ensure you have read the [Contributing code](https://github.com/trpc-group/trpc-go/blob/main/CONTRIBUTING.md#contributing-code).
The PR title should be formatted as follows: `client: remove internal info`
- The package name goes before the colon
- The part after the colon uses the verb tense + phrase that completes the blank in,
"This change modifies tRPC-Go to ___________"
- Lowercase verb after the colon
- No trailing period
- Keep the title as short as possible. ideally under 76 characters or shorter.
Add one of the following type of label:
type/bug: Fixes a newly discovered bug.
type/enhancement: Adding tests, refactoring.
type/feature: New functionality.
type/documentation: Adds documentation.
Optionally add any of the following type of label if applicable:
type/api-change: Adds, removes, or changes an API.
type/failing-test: CI test case is showing intermittent failures.
type/performance: Changes that improves performance.
type/ci: Changes the CI configuration files and scripts.
-->

<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`.
-->
Fixes #

<!--
Does this PR introduce a user-facing change?
If no, just write "NONE" below.
If yes, a release note is required, Enter your extended release note below.
A release note needs a clear, concise description of the change.
-->
RELEASE NOTES: NONE
12 changes: 12 additions & 0 deletions .github/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
coverage: # https://docs.codecov.com/docs/codecovyml-reference#coverage
precision: 5
range:
- 85.0
- 90.0
status:
project:
default:
branches:
- ^main$
target: 85.0 # the minimum coverage ratio that the commit must meet to be considered a success.
threshold: 1% # allow the coverage to drop by X%, and posting a success status.
34 changes: 33 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Here is an example of a good one:
> The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm
>
> Fixes #159
>
> RELEASE NOTES: Improved precision of Sin, Cos, and Tan for very large arguments (>1e10)
#### First line

Expand All @@ -99,6 +100,37 @@ The [benchstat](https://godoc.org/golang.org/x/perf/cmd/benchstat) tool is conve
The special notation "Fixes #12345" associates the change with issue 12345 in the tRPC-Go issue tracker.
When this change is eventually applied, the issue tracker will automatically mark the issue as fixed.

- If there is a corresponding issue, add either `Fixes #12345` or `Updates #12345` (the latter if this is not a complete fix) to this comment
- If referring to a repo other than `trpc-go` you can use the `owner/repo#issue_number` syntax: `Fixes trpc-group/tnet#12345`

#### PR type label

The PR type label is used to help identify the types of changes going into the release over time. This may allow the Release Team to develop a better understanding of what sorts of issues we would miss with a faster release cadence.

For all pull requests, one of the following PR type labels must be set:

- type/bug: Fixes a newly discovered bug.
- type/enhancement: Adding tests, refactoring.
- type/feature: New functionality.
- type/documentation: Adds documentation.
- type/api-change: Adds, removes, or changes an API.
- type/failing-test: CI test case is showing intermittent failures.
- type/performance: Changes that improves performance.
- type/ci: Changes the CI configuration files and scripts.

#### Release notes

Release notes are required for any pull request with user-visible changes, this could mean:

- User facing, critical bug-fixes
- Notable feature additions
- Deprecations or removals
- API changes
- Documents additions

If the current PR doesn't have user-visible changes, such as internal code refactoring or adding test cases, the release notes should be filled with 'NONE' and the changes in this PR will not be recorded in the next version's CHANGELOG. If the current PR has user-visible changes, the release notes should be filled out according to the actual situation, avoiding technical details and describing the impact of the current changes from a user's perspective as much as possible.

Release notes are one of the most important reference points for users about to import or upgrade to a particular release of tRPC-Go.

## Miscellaneous topics

Expand Down
34 changes: 34 additions & 0 deletions CONTRIBUTING.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ tRPC-Go 中的提交消息遵循一套特定的约定,我们将在本节中讨
> The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm
>
> Fixes #159
>
> RELEASE NOTES: Improved precision of Sin, Cos, and Tan for very large arguments (>1e10)
#### 第一行

Expand All @@ -91,6 +93,38 @@ tRPC-Go 中的提交消息遵循一套特定的约定,我们将在本节中讨
特殊表示法 "Fixes #12345" 将变更与 tRPC-Go issue 跟踪器中的 issue 12345关联。
当此变更最终应用时,issue 跟踪器将自动将该 issue 标记为已修复。

- 如果有相关 issue,请在此评论中添加 `Fixes #12345`` Updates #12345`(如果这不是完整的修复)
- 如果涉及到的仓库不是 `trpc-go`,则可以使用 `owner/repo#issue_number` 语法:`Fixes trpc-group/tnet#12345`

#### PR 类型标签

PR 类型标签用于标识当前 PR 变更所属的类型,为后续发布版本提供参考。这有助于发布团队在更快的发布周期里,准确识别当前周期内所有类型的问题。

对于所有 PR,必须设置以下之一的 PR 类型标签:

- type/bug: 修复新发现的 bug。
- type/enhancement: 添加测试,重构内部代码。
- type/feature: 新功能。
- type/documentation: 添加文档。
- type/api-change: 添加、删除或更改 API。
- type/failing-test: CI 测试用例偶发失败。
- type/performance: 改进性能的变更。
- type/ci: 更改 CI 配置文件和脚本。

#### 发布说明

对于任何造成用户可见更改的 PR,都需要提供发布说明。这可能包括:

- 用户可见的关键 bug 修复
- 显著的功能增加
- 功能弃用或移除
- API 更改
- 文档添加

如果当前 PR 没有用户可见的变更,例如代码内部重构,添加测试用例等情况,发布说明内容填为 'NONE',这个 PR 的变更就不会记录在下个版本的 CHANGELOG 中;如果当前 PR 有用户可见的变更,发布说明内容需要按照实际情况填写,尽量不要涉及技术细节,在用户视角描述当前变更会造成的影响。

发布说明是用户即将使用或升级到 tRPC-Go 特定版本时的最重要参考点之一。

## 其他主题

### 版权声明
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ English | [中文](README.zh_CN.md)
[![Coverage](https://codecov.io/gh/trpc-group/trpc-go/branch/main/graph/badge.svg)](https://app.codecov.io/gh/trpc-group/trpc-go/tree/main)


tRPC-Go, as the [Go][] language implementation of [tRPC][], is a battle-tested microservices framework that has been extensively validated in production environments. It not only delivers high performance but also offers ease of use and testability.
tRPC-Go, is the [Go][] language implementation of [tRPC][], which is a pluggable, high-performance RPC framework.

For more information, please refer to the [quick start guide][quick start] and [detailed documentation][docs].

Expand Down
2 changes: 1 addition & 1 deletion README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Coverage](https://codecov.io/gh/trpc-group/trpc-go/branch/main/graph/badge.svg)](https://app.codecov.io/gh/trpc-group/trpc-go/tree/main)


tRPC-Go,作为 [tRPC][][Go][] 语言版本,是经过大规模线上业务使用验证过的微服务框架,它不仅性能高,而且易于使用和测试
tRPC-Go, [tRPC][][Go][] 语言实现,它是一个可插拔的高性能 RPC 框架

更多信息见:[快速上手][quick start] 以及 [详细文档][docs]

Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func selectorFilter(ctx context.Context, req interface{}, rsp interface{}, next
if err != nil {
return OptionsFromContext(ctx).fixTimeout(err)
}
ensureMsgRemoteAddr(msg, node.Network, node.Address)
ensureMsgRemoteAddr(msg, findFirstNonEmpty(node.Network, opts.Network), node.Address)

// Start to process the next filter and report.
begin := time.Now()
Expand Down
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func TestClientFail(t *testing.T) {
client.WithSelectorNode(node), client.WithProtocol("fake")))
require.Equal(t, node.Address, "127.0.0.1:8080")
require.Equal(t, node.ServiceName, "127.0.0.1:8080")
require.Equal(t, node.Network, "tcp")
require.Empty(t, node.Network)

// test encode failure
reqBody = &codec.Body{Data: []byte("failbody")}
Expand Down
2 changes: 0 additions & 2 deletions client/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,6 @@ func (opts *Options) LoadNodeConfig(node *registry.Node) {
if node.Network != "" {
opts.Network = node.Network
opts.CallOptions = append(opts.CallOptions, transport.WithDialNetwork(node.Network))
} else {
node.Network = opts.Network
}
if node.Protocol != "" {
WithProtocol(node.Protocol)(opts)
Expand Down
11 changes: 10 additions & 1 deletion client/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s *stream) Init(ctx context.Context, opt ...Option) (*Options, error) {
report.SelectNodeFail.Incr()
return nil, err
}
ensureMsgRemoteAddr(msg, node.Network, node.Address)
ensureMsgRemoteAddr(msg, findFirstNonEmpty(node.Network, opts.Network), node.Address)
const invalidCost = -1
opts.Node.set(node, node.Address, invalidCost)
if opts.Codec == nil {
Expand All @@ -166,6 +166,15 @@ func (s *stream) Init(ctx context.Context, opt ...Option) (*Options, error) {
return s.opts, nil
}

func findFirstNonEmpty(ss ...string) string {
for _, s := range ss {
if s != "" {
return s
}
}
return ""
}

// Invoke implements Stream.
func (s *stream) Invoke(ctx context.Context) error {
return s.opts.StreamTransport.Init(ctx, s.opts.CallOptions...)
Expand Down
12 changes: 6 additions & 6 deletions codec_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ package trpc
import (
"errors"
"fmt"
"net"
"os"
"path"
"sync"

"trpc.group/trpc-go/trpc-go/codec"
"trpc.group/trpc-go/trpc-go/errs"
"trpc.group/trpc-go/trpc-go/internal/addrutil"
icodec "trpc.group/trpc-go/trpc-go/internal/codec"
trpcpb "trpc.group/trpc/trpc-protocol/pb/go/trpc"

Expand All @@ -46,7 +46,7 @@ var (

// NewServerStreamCodec initializes and returns a ServerStreamCodec.
func NewServerStreamCodec() *ServerStreamCodec {
return &ServerStreamCodec{initMetas: make(map[net.Addr]map[uint32]*trpcpb.TrpcStreamInitMeta), m: &sync.RWMutex{}}
return &ServerStreamCodec{initMetas: make(map[string]map[uint32]*trpcpb.TrpcStreamInitMeta), m: &sync.RWMutex{}}
}

// NewClientStreamCodec initializes and returns a ClientStreamCodec.
Expand All @@ -58,7 +58,7 @@ func NewClientStreamCodec() *ClientStreamCodec {
// Used for trpc server streaming codec.
type ServerStreamCodec struct {
m *sync.RWMutex
initMetas map[net.Addr]map[uint32]*trpcpb.TrpcStreamInitMeta // addr->streamID->TrpcStreamInitMeta
initMetas map[string]map[uint32]*trpcpb.TrpcStreamInitMeta // addr->streamID->TrpcStreamInitMeta
}

// ClientStreamCodec is an implementation of codec.Codec.
Expand Down Expand Up @@ -372,7 +372,7 @@ func (s *ServerStreamCodec) decodeFeedbackFrame(msg codec.Msg, reqBuf []byte) ([
// setInitMeta finds the InitMeta and sets the ServerRPCName by the server handler in the InitMeta.
func (s *ServerStreamCodec) setInitMeta(msg codec.Msg) error {
streamID := msg.StreamID()
addr := msg.RemoteAddr()
addr := addrutil.AddrToKey(msg.LocalAddr(), msg.RemoteAddr())
s.m.RLock()
defer s.m.RUnlock()
if streamIDToInitMeta, ok := s.initMetas[addr]; ok {
Expand All @@ -388,7 +388,7 @@ func (s *ServerStreamCodec) setInitMeta(msg codec.Msg) error {

// deleteInitMeta deletes the cached info by msg.
func (s *ServerStreamCodec) deleteInitMeta(msg codec.Msg) {
addr := msg.RemoteAddr()
addr := addrutil.AddrToKey(msg.LocalAddr(), msg.RemoteAddr())
streamID := msg.StreamID()
s.m.Lock()
defer s.m.Unlock()
Expand Down Expand Up @@ -447,7 +447,7 @@ func (s *ServerStreamCodec) decodeInitFrame(msg codec.Msg, reqBuf []byte) ([]byt
// storeInitMeta stores the InitMeta every time when a new frame is received.
func (s *ServerStreamCodec) storeInitMeta(msg codec.Msg, initMeta *trpcpb.TrpcStreamInitMeta) {
streamID := msg.StreamID()
addr := msg.RemoteAddr()
addr := addrutil.AddrToKey(msg.LocalAddr(), msg.RemoteAddr())
s.m.Lock()
defer s.m.Unlock()
if _, ok := s.initMetas[addr]; ok {
Expand Down
Loading

0 comments on commit ddf95ed

Please sign in to comment.