Rename configured_subchannel --> subchannel

Per @a11r's request
pull/2177/head
Craig Tiller 10 years ago
parent 9d0e047a5c
commit 9e8f9115c4
  1. 23
      src/core/client_config/README.md
  2. 26
      src/core/client_config/subchannel.h
  3. 45
      src/core/client_config/subchannel_factory.h

@ -25,21 +25,20 @@ Load balancing configuration is provided by a grpc_lb_policy object, stored as
part of grpc_client_config.
A load balancing policies primary job is to pick a target server given only the
initial metadata for a request. It does this by providing a
grpc_configured_channel object to the owning channel.
initial metadata for a request. It does this by providing a grpc_subchannel
object to the owning channel.
Configured Sub-Channels
-----------------------
Sub-Channels
------------
A configured sub-channel provides a connection to a server for a client
channel. It has a connectivity state like a regular channel, and so can be
connected or disconnected. This connectivity state can be used to inform load
balancing decisions (for example, by avoiding disconnected backends).
A sub-channel provides a connection to a server for a client channel. It has a
connectivity state like a regular channel, and so can be connected or
disconnected. This connectivity state can be used to inform load balancing
decisions (for example, by avoiding disconnected backends).
Configured sub-channels are fully setup to participate in the grpc data plane.
Their behavior is specified by a set of grpc channel filters defined at their
construction. To customize this behavior, resolvers build
grpc_configured_subchannel_factory objects, which use the decorator pattern
to customize construction arguments for concrete grpc_configured_subchannel
instances.
construction. To customize this behavior, resolvers build grpc_subchannel_factory
objects, which use the decorator pattern to customize construction arguments for
concrete grpc_subchannel instances.

@ -31,12 +31,12 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONFIGURED_SUBCHANNEL_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONFIGURED_SUBCHANNEL_H
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H
/** A (sub-)channel that knows how to connect to exactly one target
address. Provides a target for load balancing. */
typedef struct grpc_configured_subchannel grpc_configured_subchannel;
typedef struct grpc_subchannel grpc_subchannel;
/** Connectivity state of a channel.
TODO(ctiller): move to grpc.h when we implement the public
@ -54,19 +54,19 @@ typedef enum {
GRPC_CHANNEL_FATAL_FAILURE
} grpc_connectivity_state;
void grpc_configured_subchannel_ref(grpc_configured_subchannel *channel);
void grpc_configured_subchannel_unref(grpc_configured_subchannel *channel);
void grpc_subchannel_ref(grpc_subchannel *channel);
void grpc_subchannel_unref(grpc_subchannel *channel);
/** poll the current connectivity state of a channel */
grpc_connectivity_state grpc_configured_subchannel_check_connectivity(
grpc_configured_subchannel *channel);
grpc_connectivity_state grpc_subchannel_check_connectivity(
grpc_subchannel *channel);
/** call notify when the connectivity state of a channel changes from *state.
Updates *state with the new state of the channel */
void grpc_configured_subchannel_notify_on_state_change(
grpc_configured_subchannel *channel, grpc_connectivity_state *state,
grpc_iomgr_closure *notify);
void grpc_subchannel_notify_on_state_change(grpc_subchannel *channel,
grpc_connectivity_state *state,
grpc_iomgr_closure *notify);
/** continue processing of transport operation \a op */
void grpc_configured_subchannel_continue_op(grpc_configured_subchannel *channel,
grpc_transport_op *op);
void grpc_subchannel_continue_op(grpc_subchannel *channel,
grpc_transport_op *op);
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONFIGURED_SUBCHANNEL_H */
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H */

@ -31,21 +31,19 @@
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONFIGURED_SUBCHANNEL_FACTORY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONFIGURED_SUBCHANNEL_FACTORY_H
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
typedef struct grpc_configured_subchannel_factory
grpc_configured_subchannel_factory;
typedef struct grpc_configured_subchannel_factory_vtable
grpc_configured_subchannel_factory_vtable;
typedef struct grpc_subchannel_factory grpc_subchannel_factory;
typedef struct grpc_subchannel_factory_vtable grpc_subchannel_factory_vtable;
/** Constructor for new configured channels.
Creating decorators around this type is encouraged to adapt behavior. */
struct grpc_configured_subchannel_factory {
const grpc_configured_subchannel_factory_vtable *vtable;
struct grpc_subchannel_factory {
const grpc_subchannel_factory_vtable *vtable;
};
struct grpc_configured_subchannel_args {
struct grpc_subchannel_args {
/* TODO(ctiller): consider making (parent, metadata_context) more opaque
- these details are not needed at this level of API */
/** Parent channel element - passed from the master channel */
@ -63,24 +61,19 @@ struct grpc_configured_subchannel_args {
struct sockaddr *addr;
};
struct grpc_configured_subchannel_factory_vtable {
void (*ref)(grpc_configured_subchannel_factory *factory);
void (*unref)(grpc_configured_subchannel_factory *factory);
grpc_configured_subchannel *(*create_subchannel)(
grpc_configured_subchannel_factory *factory,
grpc_configured_subchannel_args *args);
struct grpc_subchannel_factory_vtable {
void (*ref)(grpc_subchannel_factory *factory);
void (*unref)(grpc_subchannel_factory *factory);
grpc_subchannel *(*create_subchannel)(grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
};
void grpc_configured_subchannel_factory_ref(
grpc_configured_subchannel_factory *factory);
void grpc_configured_subchannel_factory_unref(
grpc_configured_subchannel_factory *factory);
/** Create a new grpc_configured_subchannel */
void grpc_configured_subchannel_factory_create_subchannel(
grpc_configured_subchannel_factory *factory,
grpc_configured_subchannel_args *args);
void grpc_subchannel_factory_ref(grpc_subchannel_factory *factory);
void grpc_subchannel_factory_unref(grpc_subchannel_factory *factory);
/** Create a new grpc_subchannel */
void grpc_subchannel_factory_create_subchannel(grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
grpc_configured_subchannel_factory *
grpc_default_configured_subchannel_factory();
grpc_subchannel_factory *grpc_default_subchannel_factory();
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_CONFIGURED_SUBCHANNEL_FACTORY_H */
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
Loading…
Cancel
Save