endpoint

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 27 Imported by: 30

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientConnection

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

ClientConnection -

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

func Init

func Init(thing interface{}, initContext *InitContext) error

Init - initialize the thing if its initable, otherwise just fall through silently

func Log

Log - return FieldLogger from context

func MonitorServer

MonitorServer -

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

func NewCompositeEndpoint

NewCompositeEndpoint creates a new composed endpoint

func Next

Next -

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

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 WithMonitorServer

func WithMonitorServer(parent context.Context, monitorServer connectionMonitor.MonitorServer) context.Context

WithMonitorServer -

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

Types

type ClientEndpoint

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

ClientEndpoint - opens a Client connection to another Network Service

func NewClientEndpoint

func NewClientEndpoint(configuration *common.NSConfiguration) *ClientEndpoint

NewClientEndpoint creates a ClientEndpoint

func (*ClientEndpoint) Close

func (cce *ClientEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements the close handler Consumes from ctx context.Context:

Next

func (*ClientEndpoint) Name

func (cce *ClientEndpoint) Name() string

Name returns the composite name

func (*ClientEndpoint) Request

Request implements the request handler Consumes from ctx context.Context:

Next

type CompositeEndpoint

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

CompositeEndpoint is the base service composition struct

func (*CompositeEndpoint) Close

func (bce *CompositeEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements a dummy close handler

func (*CompositeEndpoint) Init

func (bce *CompositeEndpoint) Init(initContext *InitContext) error

Init initializes all the subcomponents of the composite

func (*CompositeEndpoint) Request

Request implements a dummy request handler

type ConnectionEndpoint

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

ConnectionEndpoint makes basic Mechanism selection for the incoming connection

func NewConnectionEndpoint

func NewConnectionEndpoint(configuration *common.NSConfiguration) *ConnectionEndpoint

NewConnectionEndpoint creates a ConnectionEndpoint

func (*ConnectionEndpoint) Close

func (cce *ConnectionEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements the close handler Consumes from ctx context.Context:

Next

func (*ConnectionEndpoint) Name

func (cce *ConnectionEndpoint) Name() string

Name returns the composite name

func (*ConnectionEndpoint) Request

Request implements the request handler Consumes from ctx context.Context:

Next

type ConnectionMutator

type ConnectionMutator func(context.Context, *connection.Connection) error

ConnectionMutator is function that accepts connection and modify it

func CreatePodNameMutator

func CreatePodNameMutator() ConnectionMutator

func CreateRouteMutator

func CreateRouteMutator(routes []string) ConnectionMutator

CreateRouteMutator - Creates an instance of ConnectionMutator with routes mutating

type CustomFuncEndpoint

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

CustomFuncEndpoint is endpoint that apply passed ConnectionMutator to connection that accepts from next endpoint

func NewCustomFuncEndpoint

func NewCustomFuncEndpoint(name string, mutator ConnectionMutator) *CustomFuncEndpoint

NewCustomFuncEndpoint create CustomFuncEndpoint

func (*CustomFuncEndpoint) Close

func (cf *CustomFuncEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements Close method from NetworkServiceServer Consumes from ctx context.Context:

Next

func (*CustomFuncEndpoint) Name

func (cf *CustomFuncEndpoint) Name() string

Name returns the composite name

func (*CustomFuncEndpoint) Request

Request implements Request method from NetworkServiceServer Consumes from ctx context.Context:

Next

type InitContext

type InitContext struct {
	GrpcServer *grpc.Server
}

InitContext is the context passed to the Init function of the endpoint

type Initable

type Initable interface {
	Init(*InitContext) error
}

Initable - things can be initted

type IpamEndpoint

type IpamEndpoint struct {
	PrefixPool prefix_pool.PrefixPool
}

IpamEndpoint - provides Ipam functionality

func NewIpamEndpoint

func NewIpamEndpoint(configuration *common.NSConfiguration) *IpamEndpoint

NewIpamEndpoint creates a IpamEndpoint

func (*IpamEndpoint) Close

func (ice *IpamEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements the close handler Consumes from ctx context.Context:

Next

func (*IpamEndpoint) Name

func (ice *IpamEndpoint) Name() string

Name returns the composite name

func (*IpamEndpoint) Request

Request implements the request handler Consumes from ctx context.Context:

Next

type MonitorEndpoint

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

MonitorEndpoint is a monitoring composite

func NewMonitorEndpoint

func NewMonitorEndpoint(configuration *common.NSConfiguration) *MonitorEndpoint

NewMonitorEndpoint creates a MonitorEndpoint

func (*MonitorEndpoint) Close

func (mce *MonitorEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements the close handler Request implements the request handler Consumes from ctx context.Context:

    ConnectionMonitor
	   Next

func (*MonitorEndpoint) Init

func (mce *MonitorEndpoint) Init(context *InitContext) error

Init will be called upon NSM Endpoint instantiation with the proper context

func (*MonitorEndpoint) Name

func (mce *MonitorEndpoint) Name() string

Name returns the composite name

func (*MonitorEndpoint) Request

Request implements the request handler Consumes from ctx context.Context:

    ConnectionMonitor
	   Next

type NsmEndpoint

type NsmEndpoint interface {
	Start() error
	Delete() error
}

NsmEndpoint provides the grpc mechanics for an NsmEndpoint

func NewNSMEndpoint

func NewNSMEndpoint(ctx context.Context, configuration *common.NSConfiguration, service networkservice.NetworkServiceServer) (NsmEndpoint, error)

NewNSMEndpoint creates a new NSM endpoint

type RoutesConfiguration

type RoutesConfiguration []string

RoutesConfiguration is a list of prefixes for routes

type RoutesEndpoint

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

RoutesEndpoint -

Adds routes to the ConnectionContext for the Request

func NewRoutesEndpoint

func NewRoutesEndpoint(prefixes []string) *RoutesEndpoint

NewRoutesEndpoint creates New RoutesEndpoint

func (*RoutesEndpoint) Close

Close handler

Consumes from ctx context.Context:
  Next

func (*RoutesEndpoint) Name

func (r *RoutesEndpoint) Name() string

Name returns the composite name

func (*RoutesEndpoint) Request

Request handler

Consumes from ctx context.Context:
  Next

Jump to

Keyboard shortcuts

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