descriptor

package
v0.0.0-...-d5eb696 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

* Copyright (c) 2020 PANTHEON.tech s.r.o. All rights reserved. * * 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.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClientWithoutName is returned when NSM client is configured with undefined name.
	ErrClientWithoutName = errors.New("NSM client defined without logical name")

	// ErrClientWithoutNetworkService is returned when NSM client is configured with undefined network service name.
	ErrClientWithoutNetworkService = errors.New("NSM client defined without network service name")

	// ErrClientWithoutInterface is returned when NSM client is configured with undefined interface name.
	ErrClientWithoutInterface = errors.New("NSM client defined without interface name")
)

validation errors

View Source
var (
	// ErrEndpointWithoutName is returned when NSM endpoint is configured with undefined name.
	ErrEndpointWithoutName = errors.New("NSM endpoint defined without logical name")

	// ErrEndpointWithoutNetworkService is returned when NSM endpoint is configured with undefined network service name.
	ErrEndpointWithoutNetworkService = errors.New("NSM endpoint defined without network service name")

	// ErrEndpointWithoutInterface is returned when NSM endpoint is configured with undefined interface name prefix.
	ErrEndpointWithoutInterface = errors.New("NSM endpoint defined without interface name prefix")
)

validation errors

Functions

This section is empty.

Types

type NSMClientDescriptor

type NSMClientDescriptor struct {
	// contains filtered or unexported fields
}

NSMClientDescriptor creates client connections to NSM endpoints.

func NewNSMClientDescriptor

func NewNSMClientDescriptor(log logging.PluginLogger, localclient client.ConfigClient) (descrCtx *NSMClientDescriptor, descr *kvs.KVDescriptor)

NewNSMClientDescriptor creates new instance of the descriptor.

func (*NSMClientDescriptor) Create

Creates establishes connection with NSM endpoint and creates the associated interface.

func (*NSMClientDescriptor) Delete

Delete removes interfaces and closes connection with NSM endpoint.

func (*NSMClientDescriptor) Validate

func (d *NSMClientDescriptor) Validate(key string, cfg *nsm.NetworkServiceClient) error

Validate validates NSM-Client configuration.

type NSMEndpoint

type NSMEndpoint struct {
	// contains filtered or unexported fields
}

NSMEndpoint implements the Network service endpoint functionality needed for NSM plugin. Most importantly it creates the connection interface with the requested configuration.

func NewNSMEndpoint

func NewNSMEndpoint(cfg *nsm.NetworkServiceEndpoint, log logging.Logger,
	localclient client.ConfigClient) *NSMEndpoint

NewNSMEndpoint creates an instance of NSMEndpoint.

func (*NSMEndpoint) Close

func (e *NSMEndpoint) Close(ctx context.Context, nsmConn *nsm_connection.Connection) (*empty.Empty, error)

Close removes the connection interface on the endpoint side.

func (*NSMEndpoint) CloseConnections

func (e *NSMEndpoint) CloseConnections() error

CloseConnections closes all active connections.

func (*NSMEndpoint) Name

func (e *NSMEndpoint) Name() string

Name returns the composite name.

func (*NSMEndpoint) Request

Request creates the connection interface on the endpoint side.

type NSMEndpointDemux

type NSMEndpointDemux struct {
	sync.Mutex
	// contains filtered or unexported fields
}

NSMEndpointDemux routes connection request to the corresponding network service.

func NewNSMEndpointDemux

func NewNSMEndpointDemux(log logging.Logger) *NSMEndpointDemux

NewNSMEndpoint creates an instance of NSMEndpointDemux.

func (*NSMEndpointDemux) AddEndpoint

func (x *NSMEndpointDemux) AddEndpoint(ctx context.Context, configuration *nsm_sdk_common.NSConfiguration,
	service networkservice.NetworkServiceServer, closer func() error) (err error)

AddEndpoint registers new NSM endpoint with the demultiplexer.

func (*NSMEndpointDemux) Close

Request routes the request to close a connection to the corresponding endpoint by the network service name.

func (*NSMEndpointDemux) DeleteEndpoint

func (x *NSMEndpointDemux) DeleteEndpoint(ctx context.Context, nseName string) (err error)

DeleteEndpoint unregisters NSM endpoint.

func (*NSMEndpointDemux) Request

Request routes the connection request to the corresponding endpoint by the network service name.

type NSMEndpointDescriptor

type NSMEndpointDescriptor struct {
	// contains filtered or unexported fields
}

NSMEndpointDescriptor creates NSM endpoints.

func NewNSMEndpointDescriptor

func NewNSMEndpointDescriptor(log logging.PluginLogger, localclient client.ConfigClient, notifPublisher NotificationPublisher) (
	descrCtx *NSMEndpointDescriptor, descr *kvs.KVDescriptor)

NewNSMEndpointDescriptor creates new instance of the descriptor.

func (*NSMEndpointDescriptor) Create

func (d *NSMEndpointDescriptor) Create(key string, cfg *nsm.NetworkServiceEndpoint) (metadata interface{}, err error)

Creates announces new endpoint within a given network service.

func (*NSMEndpointDescriptor) Delete

func (d *NSMEndpointDescriptor) Delete(key string, cfg *nsm.NetworkServiceEndpoint, metadata interface{}) error

Delete removes NSM endpoint.

func (*NSMEndpointDescriptor) Validate

Validate validates NSM-Endpoint configuration.

type NotificationPublisher

type NotificationPublisher interface {
	Put(key string, data proto.Message, opts ...datasync.PutOption) error
	Delete(key string, opts ...datasync.DelOption) (existed bool, err error)
}

NotificationPublisher is an optional dependency of the NSM Endpoint descriptor which, if injected, is used to publish notifications about registered endpoints.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL