Matthias Andreas Benkard | 832a54e | 2019-01-29 09:27:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright 2014 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 naming defines the naming API and related data structures for gRPC. |
| 20 | // The interface is EXPERIMENTAL and may be suject to change. |
| 21 | // |
| 22 | // Deprecated: please use package resolver. |
| 23 | package naming |
| 24 | |
| 25 | // Operation defines the corresponding operations for a name resolution change. |
| 26 | // |
| 27 | // Deprecated: please use package resolver. |
| 28 | type Operation uint8 |
| 29 | |
| 30 | const ( |
| 31 | // Add indicates a new address is added. |
| 32 | Add Operation = iota |
| 33 | // Delete indicates an existing address is deleted. |
| 34 | Delete |
| 35 | ) |
| 36 | |
| 37 | // Update defines a name resolution update. Notice that it is not valid having both |
| 38 | // empty string Addr and nil Metadata in an Update. |
| 39 | // |
| 40 | // Deprecated: please use package resolver. |
| 41 | type Update struct { |
| 42 | // Op indicates the operation of the update. |
| 43 | Op Operation |
| 44 | // Addr is the updated address. It is empty string if there is no address update. |
| 45 | Addr string |
| 46 | // Metadata is the updated metadata. It is nil if there is no metadata update. |
| 47 | // Metadata is not required for a custom naming implementation. |
| 48 | Metadata interface{} |
| 49 | } |
| 50 | |
| 51 | // Resolver creates a Watcher for a target to track its resolution changes. |
| 52 | // |
| 53 | // Deprecated: please use package resolver. |
| 54 | type Resolver interface { |
| 55 | // Resolve creates a Watcher for target. |
| 56 | Resolve(target string) (Watcher, error) |
| 57 | } |
| 58 | |
| 59 | // Watcher watches for the updates on the specified target. |
| 60 | // |
| 61 | // Deprecated: please use package resolver. |
| 62 | type Watcher interface { |
| 63 | // Next blocks until an update or error happens. It may return one or more |
| 64 | // updates. The first call should get the full set of the results. It should |
| 65 | // return an error if and only if Watcher cannot recover. |
| 66 | Next() ([]*Update, error) |
| 67 | // Close closes the Watcher. |
| 68 | Close() |
| 69 | } |