diff options
author | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
---|---|---|
committer | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
commit | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/google.golang.org/grpc/connectivity/connectivity.go | |
parent | 07971ca38143c5faf951d152fba370ddcbe26ad5 (diff) | |
download | terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip |
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/google.golang.org/grpc/connectivity/connectivity.go')
-rw-r--r-- | vendor/google.golang.org/grpc/connectivity/connectivity.go | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/vendor/google.golang.org/grpc/connectivity/connectivity.go b/vendor/google.golang.org/grpc/connectivity/connectivity.go new file mode 100644 index 0000000..568ef5d --- /dev/null +++ b/vendor/google.golang.org/grpc/connectivity/connectivity.go | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright 2017 gRPC authors. | ||
4 | * | ||
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | * you may not use this file except in compliance with the License. | ||
7 | * You may obtain a copy of the License at | ||
8 | * | ||
9 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | * | ||
11 | * Unless required by applicable law or agreed to in writing, software | ||
12 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | * See the License for the specific language governing permissions and | ||
15 | * limitations under the License. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | // Package connectivity defines connectivity semantics. | ||
20 | // For details, see https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md. | ||
21 | // All APIs in this package are experimental. | ||
22 | package connectivity | ||
23 | |||
24 | import ( | ||
25 | "golang.org/x/net/context" | ||
26 | "google.golang.org/grpc/grpclog" | ||
27 | ) | ||
28 | |||
29 | // State indicates the state of connectivity. | ||
30 | // It can be the state of a ClientConn or SubConn. | ||
31 | type State int | ||
32 | |||
33 | func (s State) String() string { | ||
34 | switch s { | ||
35 | case Idle: | ||
36 | return "IDLE" | ||
37 | case Connecting: | ||
38 | return "CONNECTING" | ||
39 | case Ready: | ||
40 | return "READY" | ||
41 | case TransientFailure: | ||
42 | return "TRANSIENT_FAILURE" | ||
43 | case Shutdown: | ||
44 | return "SHUTDOWN" | ||
45 | default: | ||
46 | grpclog.Errorf("unknown connectivity state: %d", s) | ||
47 | return "Invalid-State" | ||
48 | } | ||
49 | } | ||
50 | |||
51 | const ( | ||
52 | // Idle indicates the ClientConn is idle. | ||
53 | Idle State = iota | ||
54 | // Connecting indicates the ClienConn is connecting. | ||
55 | Connecting | ||
56 | // Ready indicates the ClientConn is ready for work. | ||
57 | Ready | ||
58 | // TransientFailure indicates the ClientConn has seen a failure but expects to recover. | ||
59 | TransientFailure | ||
60 | // Shutdown indicates the ClientConn has started shutting down. | ||
61 | Shutdown | ||
62 | ) | ||
63 | |||
64 | // Reporter reports the connectivity states. | ||
65 | type Reporter interface { | ||
66 | // CurrentState returns the current state of the reporter. | ||
67 | CurrentState() State | ||
68 | // WaitForStateChange blocks until the reporter's state is different from the given state, | ||
69 | // and returns true. | ||
70 | // It returns false if <-ctx.Done() can proceed (ctx got timeout or got canceled). | ||
71 | WaitForStateChange(context.Context, State) bool | ||
72 | } | ||