common

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

Package common - define a common set of services for both local/remote chains

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStrings2Path

func AppendStrings2Path(path *connection.Path, strs ...string) *connection.Path

AppendStrings2Path is a utility function to append PathSegments to a Path from a list of Names

func ClientConnection

func ClientConnection(ctx context.Context) *connection.Connection

ClientConnection -

Returns a ClientConnection from:
  ctx context.Context
If any is present, otherwise nil

func ConnectionMonitor

func ConnectionMonitor(ctx context.Context) connectionmonitor.MonitorServer

ConnectionMonitor -

Returns a ConnectionMonitor from:
  ctx context.Context
If any is present, otherwise nil

func Endpoint

func Endpoint(ctx context.Context) *registry.NSERegistration

Endpoint - Return selected endpoint object

func EndpointConnection

func EndpointConnection(ctx context.Context) *connection.Connection

EndpointConnection - Return endpoint connection object

func Forwarder

func Forwarder(ctx context.Context) *model.Forwarder

Forwarder - Return forwarder

func IgnoredEndpoints

IgnoredEndpoints - Return a map of ignored endpoints or empty map. key == endpointname + ":" + NetworkServiceManager.Url

func Log

Log - return FieldLogger from context

func ModelConnection

func ModelConnection(ctx context.Context) *model.ClientConnection

ModelConnection -

Returns a ModelConnection from:
  ctx context.Context
If any is present, otherwise nil

func NewCompositeService

func NewCompositeService(factoryName string, services ...networkservice.NetworkServiceServer) networkservice.NetworkServiceServer

NewCompositeService creates a new composed endpoint

func NewCrossConnectService

func NewCrossConnectService() networkservice.NetworkServiceServer

NewCrossConnectService - creates a service to create a cross connect

func NewExcludedPrefixesService

func NewExcludedPrefixesService() networkservice.NetworkServiceServer

NewExcludedPrefixesService - creates a service to select endpoint.

func NewExcludedPrefixesServiceFromPath

func NewExcludedPrefixesServiceFromPath(configPath string) networkservice.NetworkServiceServer

NewExcludedPrefixesService - creates a service to select endpoint.

func NewMonitorService

NewMonitorService - Perform updates to workspace monitoring services.

func NewRequestValidator

func NewRequestValidator() networkservice.NetworkServiceServer

NewRequestValidator - creates a service to verify request

func Next

Next -

Returns the Next networkservice.NetworkServiceServer to be called in the chain from the context.Context

func OriginalSpan

func OriginalSpan(ctx context.Context) spanhelper.SpanHelper

OriginalSpan - Return forwarder

func ProcessClose

func ProcessClose(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

ProcessClose - perform a next close operation on chain if defined

func ProcessNext

ProcessNext - performs a next operation on chain if defined.

func RemoteMechanisms

func RemoteMechanisms(ctx context.Context) []*connection.Mechanism

RemoteMechanisms -

Returns a Mechanism from:
  ctx context.Context
If any is present, otherwise nil

func SpanHelperFromConnection

func SpanHelperFromConnection(ctx context.Context, clientConnection *model.ClientConnection, operation string) spanhelper.SpanHelper

SpanHelperFromConnection - construct new span helper with span from context is present or span from connection object

func Strings2Path

func Strings2Path(strs ...string) *connection.Path

Strings2Path is a utility function to create a Path from a list of NSMgr names

func WithClientConnection

func WithClientConnection(parent context.Context, connection *connection.Connection) context.Context

WithClientConnection -

  Wraps 'parent' in a new Context that has the ClientConnection
  provided in:
      connection *connection.Connection
  using Context.Value(...) and returns the result.
  Note: any previously existing ClientConnection will be overwritten.

  Recommended use: in any Request or Close call that creates a ClientConnection, call:
     ctx = WithClientConnection(ctx)
  to ensure that the ctx has a ClientConnection
  In any Request or Close call that consumes a ClientConnection, call:
	    connectionMap := ClientConnection(ctx)
  to retrieve the ClientConnection from the context.Context

func WithConnectionMonitor

func WithConnectionMonitor(parent context.Context, monitorServer connectionmonitor.MonitorServer) context.Context

WithConnectionMonitor -

Wraps 'parent' in a new Context that has the local connection Monitor
using Context.Value(...) and returns the result.
Note: any previously existing ConnectionMonitor will be overwritten.

func WithEndpoint

func WithEndpoint(parent context.Context, endpoint *registry.NSERegistration) context.Context

WithEndpoint -

Wraps 'parent' in a new Context that has the endpoint selected
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithEndpointConnection

func WithEndpointConnection(parent context.Context, connection *connection.Connection) context.Context

WithEndpointConnection -

Wraps 'parent' in a new Context that has endpoint connection object
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithForwarder

func WithForwarder(parent context.Context, dp *model.Forwarder) context.Context

WithForwarder -

Wraps 'parent' in a new Context that has the forwarder selected
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithIgnoredEndpoints

func WithIgnoredEndpoints(parent context.Context, endpoints map[registry.EndpointNSMName]*registry.NSERegistration) context.Context

WithIgnoredEndpoints -

Wraps 'parent' in a new Context that has the map of ignored endpoints
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithLog

func WithLog(parent context.Context, log logrus.FieldLogger) context.Context

WithLog -

Provides a FieldLogger in context

func WithModelConnection

func WithModelConnection(parent context.Context, connection *model.ClientConnection) context.Context

WithModelConnection -

Wraps 'parent' in a new Context that has the model connection
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithNext

WithNext -

Wraps 'parent' in a new Context that has the Next networkservice.NetworkServiceServer to be called in the chain
Should only be set in CompositeNetworkService.Request/Close

func WithOriginalSpan

func WithOriginalSpan(parent context.Context, span spanhelper.SpanHelper) context.Context

WithOriginalSpan -

Wraps 'parent' in a new Context that has the original opentracing Span.
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithRemoteMechanisms

func WithRemoteMechanisms(parent context.Context, mechanisms []*connection.Mechanism) context.Context

WithRemoteMechanisms -

Wraps 'parent' in a new Context that has the remote mechanisms
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WithWorkspaceName

func WithWorkspaceName(parent context.Context, name string) context.Context

WithWorkspaceName -

Wraps 'parent' in a new Context that has the workspace name;
using Context.Value(...) and returns the result.
Note: any previously existing value will be overwritten.

func WorkspaceName

func WorkspaceName(ctx context.Context) string

WorkspaceName - Return a workspace name

Types

type CompositeNetworkService

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

CompositeNetworkService is the base service composition struct

func (*CompositeNetworkService) Close

func (cns *CompositeNetworkService) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements a dummy close handler

func (*CompositeNetworkService) Request

Request implements a dummy request handler

type ContextKeyType

type ContextKeyType string

ContextKeyType - a type object for context values.

Jump to

Keyboard shortcuts

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