blob: 270d04997ae20075000afda64c8d6132732b5bd7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
//
// Copyright 2019 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef GRPC_SRC_CORE_EXT_XDS_XDS_BOOTSTRAP_H
#define GRPC_SRC_CORE_EXT_XDS_XDS_BOOTSTRAP_H
#include <grpc/support/port_platform.h>
#include <util/generic/string.h>
#include <util/string/cast.h>
#include "src/core/lib/json/json.h"
namespace grpc_core {
bool XdsFederationEnabled();
class XdsBootstrap {
public:
class Node {
public:
virtual ~Node() = default;
virtual const TString& id() const = 0;
virtual const TString& cluster() const = 0;
virtual const TString& locality_region() const = 0;
virtual const TString& locality_zone() const = 0;
virtual const TString& locality_sub_zone() const = 0;
virtual const Json::Object& metadata() const = 0;
};
class XdsServer {
public:
virtual ~XdsServer() = default;
virtual const TString& server_uri() const = 0;
virtual bool IgnoreResourceDeletion() const = 0;
virtual bool Equals(const XdsServer& other) const = 0;
friend bool operator==(const XdsServer& a, const XdsServer& b) {
return a.Equals(b);
}
};
class Authority {
public:
virtual ~Authority() = default;
virtual const XdsServer* server() const = 0;
};
virtual ~XdsBootstrap() = default;
virtual TString ToString() const = 0;
// TODO(roth): We currently support only one server. Fix this when we
// add support for fallback for the xds channel.
virtual const XdsServer& server() const = 0;
// Returns the node information, or null if not present in the bootstrap
// config.
virtual const Node* node() const = 0;
// Returns a pointer to the specified authority, or null if it does
// not exist in this bootstrap config.
virtual const Authority* LookupAuthority(const TString& name) const = 0;
// If the server exists in the bootstrap config, returns a pointer to
// the XdsServer instance in the config. Otherwise, returns null.
virtual const XdsServer* FindXdsServer(const XdsServer& server) const = 0;
};
} // namespace grpc_core
#endif // GRPC_SRC_CORE_EXT_XDS_XDS_BOOTSTRAP_H
|