diff options
author | Eric Anderson <ejona@google.com> | 2017-11-08 11:32:01 -0800 |
---|---|---|
committer | Eric Anderson <ejona@google.com> | 2017-11-08 11:36:19 -0800 |
commit | f0901946667b05714d6dc99a905506e4715a3a80 (patch) | |
tree | 2f912b61f81ba9046c9671ffcd5598a29ec87d90 | |
parent | a4265d464c54cbff6946a5d7b69e3a4b8358be68 (diff) |
doc: Fully define GetState in connectivity state API
-rw-r--r-- | doc/connectivity-semantics-and-api.md | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/connectivity-semantics-and-api.md b/doc/connectivity-semantics-and-api.md index 6d39619d65..dc30fe5348 100644 --- a/doc/connectivity-semantics-and-api.md +++ b/doc/connectivity-semantics-and-api.md @@ -115,8 +115,14 @@ Channel State API ----------------- All gRPC libraries will expose a channel-level API method to poll the current -state of a channel. In C++, this method is called GetCurrentState and returns -an enum for one of the five legal states. +state of a channel. In C++, this method is called GetState and returns an enum +for one of the five legal states. It also accepts a boolean `try_to_connect` to +transition to CONNECTING if the channel is currently IDLE. The boolean should +act as if an RPC occurred, so it should also reset IDLE_TIMEOUT. + +```cpp +grpc_connectivity_state GetState(bool try_to_connect); +``` All libraries should also expose an API that enables the application (user of the gRPC API) to be notified when the channel state changes. Since state @@ -127,11 +133,11 @@ the user to poll the channel for the current state. The synchronous version of this API is: ```cpp -bool WaitForStateChange(gpr_timespec deadline, ChannelState source_state); +bool WaitForStateChange(grpc_connectivity_state source_state, gpr_timespec deadline); ``` -which returns true when the state changes to something other than the -source_state and false if the deadline expires. Asynchronous and futures based +which returns `true` when the state is something other than the +`source_state` and `false` if the deadline expires. Asynchronous- and futures-based APIs should have a corresponding method that allows the application to be notified when the state of a channel changes. |