googleapis / googleapis/google-cloud-cpp

Support idempotency token for Storage client

オープン
#12,294 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
api: storage external type: feature request
主要言語
C++
スター
659
フォーク
462
平均マージ
1日 2時間
マージ済み PR(30日)
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 `RetryClient` need 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:

```cc
virtual StatusOr 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:

```cc
virtual StatusOr 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](http://goto.google.com/gcs-client-idem-token)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、issueで言及されているRetryClient、RawClient、およびgRPCとRESTの実装を追跡します。contextと明示的なOptionsのフローを含め、*Connectionと*Stubのスタックがどのように分離されているかを確認します。完了条件は、tokenが作成され、両方の実装を通じて伝播され、サービスヘッダーとして送信され、mockingとretryの動作が維持されることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, gcp, grpc
領域
api, backend-api-design, cloud
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。