Documentation
¶
Overview ¶
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
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.
package cloud_registry provides CloudRegistry interface for Go based gateways
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
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.
package cloud_registry provides CloudRegistry interface for Go based gateways
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetServiceAddress ¶
Returns the RPC address of the service. The service needs to be added to the registry before this.
Types ¶
type GatewayRegistry ¶
type GatewayRegistry interface { // platform's ServiceRegistry methods AddServices(locations ...platform_registry.ServiceLocation) AddService(location platform_registry.ServiceLocation) GetServiceAddress(service string) (string, error) GetServicePort(service string) (int, error) GetServiceProxyAliases(service string) (map[string]int, error) ListAllServices() []string // Gateway specific methods // // GetCloudConnection Creates and returns a new GRPC service connection to the service. // GetCloudConnection always creates a new connection & it's responsibility of the caller to close it. GetCloudConnection(service string) (*grpc.ClientConn, error) // GetCloudConnectionFromServiceConfig returns a connection to the cloud // using a specific control_proxy service config map. This map must contain the cloud_address // and local_port params // Input: serviceConfig - ConfigMap containing cloud_address and local_port and optional proxy_cloud_connections, // cloud_port, rootca_cert, gateway_cert/key fields if direct cloud connection is needed // service - name of cloud service to connect to // Output: *grpc.ClientConn with connection to cloud service error if it exists GetCloudConnectionFromServiceConfig(controlProxyConfig *config.ConfigMap, service string) (*grpc.ClientConn, error) // either directly or via control proxy // GetSharedCloudConnection will return an existing cached cloud connection if it's available and healthy, // if not - it'll try to create, cache and return a new cloud connection GetSharedCloudConnection(service string) (*grpc.ClientConn, error) // using a specific control_proxy service config map. This map must contain the cloud_address // and local_port params // GetSharedCloudConnectionFromServiceConfig will return an existing cached cloud connection if it's available and // healthy, if not - it'll try to create, cache and return a new cloud connection GetSharedCloudConnectionFromServiceConfig(controlProxyConfig *config.ConfigMap, service string) (*grpc.ClientConn, error) CleanupSharedCloudConnection(service string) bool // GetConnection provides a gRPC connection to a service in the registry. GetConnection(service string) (*grpc.ClientConn, error) GetConnectionImpl(ctx context.Context, service string, opts ...grpc.DialOption) (*grpc.ClientConn, error) }
ServiceRegistry defines interface for gateway's registry of local services
func Get ¶
func Get() GatewayRegistry
Get returns default service registry which can be shared by all GW process services
func New ¶
func New() GatewayRegistry
New returns a new ProxiedRegistry initialized with empty service & connection maps
func NewDefaultRegistry ¶
func NewDefaultRegistry() GatewayRegistry
NewDefaultRegistry returns a new service registry populated by default services
type ProxiedRegistry ¶
type ProxiedRegistry platform_registry.ServiceRegistry
ProxiedRegistry a GW service registry which supports direct and proxied cloud connections