googleapis / googleapis/google-cloud-cpp
Support idempotency token for Storage client
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 659
- 派生
- 463
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 89
描述
The GCS API supports (or soon will support) an idempotency token header. The header allows GCS to detect if a request is a duplicate, and returns the same value for duplicate requests.
To implement this we need to:
- Create the unique id in the
RetryClient - The decorators below
RetryClientneed to accept a new "context" field on each function - The gRPC and REST-based implementations need to consume this field and send it to the service as a header.
It is time to split the RawClient stack in two, like we do for all the other libraries. The *Connection stack will be used for mocks and to implement the retry loop. The typical function will look like so:
virtual StatusOr<BucketMetadata> GetBucketMetadata(
GetBucketMetadataRequest const& request) = 0;
The *Stub will implement logging, tracing, and actually sending the data to the service, the typical function will look like so:
virtual StatusOr<BucketMetadata> GetBucketMetadata(
rest_internal::RestContext& context,
Options const& options,
GetBucketMetadataRequest const& request) = 0;
Note how the options are passed explicitly and not tunneled via CurrentOptions. Also note that the "context" object is REST-based. We can change both over time, as the classes in the *Stub hierarchy are not needed for mocking.
Java implemented this in:
https://github.com/googleapis/java-storage/pull/2027
Internally, the design doc is go/gcs-client-idem-token
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 issue 中提到的 RetryClient、RawClient 以及 gRPC 和 REST 实现。检查 *Connection 和 *Stub stack 是如何分离的,包括 context 和显式 Options 的流转。完成的标准是创建 token,通过两个实现进行传播,并作为服务标头发送,同时保留 mocking 和 retry 行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- cpp, gcp, grpc
- 领域
- api, backend-api-design, cloud
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100