You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

70 line
2.2 KiB

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