2 # Generated by the protocol buffer compiler. DO NOT EDIT!
3 # source: src/proto/grpc/testing/messages.proto
5 namespace Grpc\Testing;
7 use UnexpectedValueException;
10 * The type of route that a client took to reach a server w.r.t. gRPCLB.
11 * The server must fill in "fallback" if it detects that the RPC reached
12 * the server via the "gRPCLB fallback" path, and "backend" if it detects
13 * that the RPC reached the server via "gRPCLB backend" path (i.e. if it got
14 * the address of this server from the gRPCLB server BalanceLoad RPC). Exactly
15 * how this detection is done is context and server dependent.
17 * Protobuf type <code>grpc.testing.GrpclbRouteType</code>
22 * Server didn't detect the route that a client took to reach it.
24 * Generated from protobuf enum <code>GRPCLB_ROUTE_TYPE_UNKNOWN = 0;</code>
26 const GRPCLB_ROUTE_TYPE_UNKNOWN = 0;
28 * Indicates that a client reached a server via gRPCLB fallback.
30 * Generated from protobuf enum <code>GRPCLB_ROUTE_TYPE_FALLBACK = 1;</code>
32 const GRPCLB_ROUTE_TYPE_FALLBACK = 1;
34 * Indicates that a client reached a server as a gRPCLB-given backend.
36 * Generated from protobuf enum <code>GRPCLB_ROUTE_TYPE_BACKEND = 2;</code>
38 const GRPCLB_ROUTE_TYPE_BACKEND = 2;
40 private static $valueToName = [
41 self::GRPCLB_ROUTE_TYPE_UNKNOWN => 'GRPCLB_ROUTE_TYPE_UNKNOWN',
42 self::GRPCLB_ROUTE_TYPE_FALLBACK => 'GRPCLB_ROUTE_TYPE_FALLBACK',
43 self::GRPCLB_ROUTE_TYPE_BACKEND => 'GRPCLB_ROUTE_TYPE_BACKEND',
46 public static function name($value)
48 if (!isset(self::$valueToName[$value])) {
49 throw new UnexpectedValueException(sprintf(
50 'Enum %s has no name defined for value %s', __CLASS__, $value));
52 return self::$valueToName[$value];
56 public static function value($name)
58 $const = __CLASS__ . '::' . strtoupper($name);
59 if (!defined($const)) {
60 throw new UnexpectedValueException(sprintf(
61 'Enum %s has no value defined for name %s', __CLASS__, $name));
63 return constant($const);