Skip to content

Commit

Permalink
Remove idempotent/cacheable requests (grpc#28922)
Browse files Browse the repository at this point in the history
* Remove idempotent/cacheable requests

* more cleanup

* bump core version

* fix

* fix

* fix

* review feedback

* fixes

* fix

* remove more

* objc

* fix

* fix

* fix

* scrub

* Modify XdsRbacTests

Co-authored-by: Yash Tibrewal <yashkt@google.com>
  • Loading branch information
ctiller and yashykt authored Mar 4, 2022
1 parent b8bbe30 commit fe91338
Show file tree
Hide file tree
Showing 36 changed files with 39 additions and 1,663 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions gRPC-Core.podspec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions grpc.gyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions include/grpc/impl/codegen/grpc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,25 +518,19 @@ typedef enum grpc_call_error {

/** Initial metadata flags */
/** These flags are to be passed to the `grpc_op::flags` field */
/** Signal that the call is idempotent */
#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST (0x00000010u)
/** Signal that the call should not return UNAVAILABLE before it has started */
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY (0x00000020u)
/** Signal that the call is cacheable. GRPC is free to use GET verb */
#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST (0x00000040u)
/** Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set
by the calling application. */
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET (0x00000080u)
/** Signal that the initial metadata should be corked */
#define GRPC_INITIAL_METADATA_CORKED (0x00000100u)

/** Mask of all valid flags */
#define GRPC_INITIAL_METADATA_USED_MASK \
(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST | \
GRPC_INITIAL_METADATA_WAIT_FOR_READY | \
GRPC_INITIAL_METADATA_CACHEABLE_REQUEST | \
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET | \
GRPC_INITIAL_METADATA_CORKED | GRPC_WRITE_THROUGH)
#define GRPC_INITIAL_METADATA_USED_MASK \
(GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET | \
GRPC_INITIAL_METADATA_WAIT_FOR_READY | GRPC_INITIAL_METADATA_CORKED | \
GRPC_WRITE_THROUGH)

/** A single metadata element */
typedef struct grpc_metadata {
Expand Down
18 changes: 1 addition & 17 deletions include/grpcpp/impl/codegen/client_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,18 +276,6 @@ class ClientContext {
deadline_ = deadline_tp.raw_time();
}

/// EXPERIMENTAL: Indicate that this request is idempotent.
/// By default, RPCs are assumed to <i>not</i> be idempotent.
///
/// If true, the gRPC library assumes that it's safe to initiate
/// this RPC multiple times.
void set_idempotent(bool idempotent) { idempotent_ = idempotent; }

/// EXPERIMENTAL: Set this request to be cacheable.
/// If set, grpc is free to use the HTTP GET verb for sending the request,
/// with the possibility of receiving a cached response.
void set_cacheable(bool cacheable) { cacheable_ = cacheable; }

/// Trigger wait-for-ready or not on this request.
/// See https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md.
/// If set, if an RPC is made when a channel's connectivity state is
Expand Down Expand Up @@ -484,9 +472,7 @@ class ClientContext {
}

uint32_t initial_metadata_flags() const {
return (idempotent_ ? GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST : 0) |
(wait_for_ready_ ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0) |
(cacheable_ ? GRPC_INITIAL_METADATA_CACHEABLE_REQUEST : 0) |
return (wait_for_ready_ ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0) |
(wait_for_ready_explicitly_set_
? GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
: 0) |
Expand All @@ -504,8 +490,6 @@ class ClientContext {
bool initial_metadata_received_;
bool wait_for_ready_;
bool wait_for_ready_explicitly_set_;
bool idempotent_;
bool cacheable_;
std::shared_ptr<grpc::Channel> channel_;
grpc::internal::Mutex mu_;
grpc_call* call_;
Expand Down
Loading

0 comments on commit fe91338

Please sign in to comment.