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 ¶
- Variables
- type NSMClientDescriptor
- func (d *NSMClientDescriptor) Create(key string, cfg *nsm.NetworkServiceClient) (metadata *nsmetadata.NsmClientMetadata, err error)
- func (d *NSMClientDescriptor) Delete(key string, cfg *nsm.NetworkServiceClient, ...) error
- func (d *NSMClientDescriptor) Validate(key string, cfg *nsm.NetworkServiceClient) error
- type NSMEndpoint
- func (e *NSMEndpoint) Close(ctx context.Context, nsmConn *nsm_connection.Connection) (*empty.Empty, error)
- func (e *NSMEndpoint) CloseConnections() error
- func (e *NSMEndpoint) Name() string
- func (e *NSMEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*nsm_connection.Connection, error)
- type NSMEndpointDemux
- func (x *NSMEndpointDemux) AddEndpoint(ctx context.Context, configuration *nsm_sdk_common.NSConfiguration, ...) (err error)
- func (x *NSMEndpointDemux) Close(ctx context.Context, conn *nsm_connection.Connection) (*empty.Empty, error)
- func (x *NSMEndpointDemux) DeleteEndpoint(ctx context.Context, nseName string) (err error)
- func (x *NSMEndpointDemux) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*nsm_connection.Connection, error)
- type NSMEndpointDescriptor
- func (d *NSMEndpointDescriptor) Create(key string, cfg *nsm.NetworkServiceEndpoint) (metadata interface{}, err error)
- func (d *NSMEndpointDescriptor) Delete(key string, cfg *nsm.NetworkServiceEndpoint, metadata interface{}) error
- func (d *NSMEndpointDescriptor) Validate(key string, cfg *nsm.NetworkServiceEndpoint) error
- type NotificationPublisher
Constants ¶
This section is empty.
Variables ¶
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
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 ¶
func (d *NSMClientDescriptor) Create(key string, cfg *nsm.NetworkServiceClient) (metadata *nsmetadata.NsmClientMetadata, err error)
Creates establishes connection with NSM endpoint and creates the associated interface.
func (*NSMClientDescriptor) Delete ¶
func (d *NSMClientDescriptor) Delete(key string, cfg *nsm.NetworkServiceClient, metadata *nsmetadata.NsmClientMetadata) error
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) Request ¶
func (e *NSMEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*nsm_connection.Connection, error)
Request creates the connection interface on the endpoint side.
type NSMEndpointDemux ¶
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 ¶
func (x *NSMEndpointDemux) Close(ctx context.Context, conn *nsm_connection.Connection) (*empty.Empty, error)
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 ¶
func (x *NSMEndpointDemux) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*nsm_connection.Connection, error)
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 ¶
func (d *NSMEndpointDescriptor) Validate(key string, cfg *nsm.NetworkServiceEndpoint) error
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.