Resolver is also a resolver builder. It's build() function always returns itself.
| 42 | // Resolver is also a resolver builder. |
| 43 | // It's build() function always returns itself. |
| 44 | type Resolver struct { |
| 45 | // BuildCallback is called when the Build method is called. Must not be |
| 46 | // nil. Must not be changed after the resolver may be built. |
| 47 | BuildCallback func(resolver.Target, resolver.ClientConn, resolver.BuildOptions) |
| 48 | // UpdateStateCallback is called when the UpdateState method is called on |
| 49 | // the resolver. The value passed as argument to this callback is the value |
| 50 | // returned by the resolver.ClientConn. Must not be nil. Must not be |
| 51 | // changed after the resolver may be built. |
| 52 | UpdateStateCallback func(err error) |
| 53 | // ResolveNowCallback is called when the ResolveNow method is called on the |
| 54 | // resolver. Must not be nil. Must not be changed after the resolver may |
| 55 | // be built. |
| 56 | ResolveNowCallback func(resolver.ResolveNowOptions) |
| 57 | // CloseCallback is called when the Close method is called. Must not be |
| 58 | // nil. Must not be changed after the resolver may be built. |
| 59 | CloseCallback func() |
| 60 | scheme string |
| 61 | |
| 62 | // Fields actually belong to the resolver. |
| 63 | // Guards access to below fields. |
| 64 | mu sync.Mutex |
| 65 | cc resolver.ClientConn |
| 66 | // Storing the most recent state update makes this resolver resilient to |
| 67 | // restarts, which is possible with channel idleness. |
| 68 | lastSeenState *resolver.State |
| 69 | } |
| 70 | |
| 71 | // InitialState adds initial state to the resolver so that UpdateState doesn't |
| 72 | // need to be explicitly called after Dial. |
nothing calls this directly
no outgoing calls
no test coverage detected