Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: third_party/grpc/src/core/client_config/resolver.h

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34 #ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_H
35 #define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_H
36
37 #include "src/core/client_config/client_config.h"
38 #include "src/core/client_config/subchannel.h"
39 #include "src/core/iomgr/iomgr.h"
40
41 typedef struct grpc_resolver grpc_resolver;
42 typedef struct grpc_resolver_vtable grpc_resolver_vtable;
43
44 /** grpc_resolver provides grpc_client_config objects to grpc_channel
45 objects */
46 struct grpc_resolver {
47 const grpc_resolver_vtable *vtable;
48 gpr_refcount refs;
49 };
50
51 struct grpc_resolver_vtable {
52 void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
53 void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
54 void (*channel_saw_error)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
55 void (*next)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
56 grpc_client_config **target_config, grpc_closure *on_complete);
57 };
58
59 #ifdef GRPC_RESOLVER_REFCOUNT_DEBUG
60 #define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r))
61 #define GRPC_RESOLVER_UNREF(cl, p, r) \
62 grpc_resolver_unref((cl), (p), __FILE__, __LINE__, (r))
63 void grpc_resolver_ref(grpc_resolver *policy, const char *file, int line,
64 const char *reason);
65 void grpc_resolver_unref(grpc_resolver *policy, grpc_closure_list *closure_list,
66 const char *file, int line, const char *reason);
67 #else
68 #define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p))
69 #define GRPC_RESOLVER_UNREF(cl, p, r) grpc_resolver_unref((cl), (p))
70 void grpc_resolver_ref(grpc_resolver *policy);
71 void grpc_resolver_unref(grpc_exec_ctx *exec_ctx, grpc_resolver *policy);
72 #endif
73
74 void grpc_resolver_init(grpc_resolver *resolver,
75 const grpc_resolver_vtable *vtable);
76
77 void grpc_resolver_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
78
79 /** Notification that the channel has seen an error on some address.
80 Can be used as a hint that re-resolution is desirable soon. */
81 void grpc_resolver_channel_saw_error(grpc_exec_ctx *exec_ctx,
82 grpc_resolver *resolver);
83
84 /** Get the next client config. Called by the channel to fetch a new
85 configuration. Expected to set *target_config with a new configuration,
86 and then schedule on_complete for execution.
87
88 If resolution is fatally broken, set *target_config to NULL and
89 schedule on_complete. */
90 void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
91 grpc_client_config **target_config,
92 grpc_closure *on_complete);
93
94 #endif /* GRPC_INTERNAL_CORE_CONFIG_RESOLVER_H */
OLDNEW
« no previous file with comments | « third_party/grpc/src/core/client_config/lb_policy_registry.c ('k') | third_party/grpc/src/core/client_config/resolver.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698