googleapis / googleapis/google-cloud-cpp

Support idempotency token for Storage client

Đang mở
#12,294 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: storage external type: feature request
Ngôn ngữ chính
C++
Star
659
Fork
462
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
89

Mô tả

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)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi các triển khai RetryClient, RawClient, gRPC và REST được đề cập trong issue. Xem xét cách các stack *Connection và *Stub được tách biệt, bao gồm luồng của context và các Options tường minh. Hoàn tất có nghĩa là token được tạo, được truyền qua cả hai triển khai và được gửi dưới dạng service header, đồng thời vẫn giữ nguyên hành vi mocking và retry.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, gcp, grpc
Lĩnh vực
api, backend-api-design, cloud
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.