model

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConnection

type ClientConnection struct {
	ConnectionID            string
	Request                 *networkservice.NetworkServiceRequest
	Xcon                    *crossconnect.CrossConnect
	RemoteNsm               *registry.NetworkServiceManager
	Endpoint                *registry.NSERegistration
	ForwarderRegisteredName string
	ConnectionState         ClientConnectionState
	ForwarderState          ForwarderState
	Span                    spanhelper.SpanHelper
	Monitor                 connectionmonitor.MonitorServer
}

ClientConnection struct in model that describes cross connect between NetworkServiceClient and NetworkServiceEndpoint

func (*ClientConnection) GetConnectionDestination

func (cc *ClientConnection) GetConnectionDestination() *connection.Connection

GetConnectionDestination returns destination part of connection

func (*ClientConnection) GetConnectionSource

func (cc *ClientConnection) GetConnectionSource() *connection.Connection

GetConnectionSource returns source part of connection

func (*ClientConnection) GetID

func (cc *ClientConnection) GetID() string

GetID returns id of clientConnection

func (*ClientConnection) GetNetworkService

func (cc *ClientConnection) GetNetworkService() string

GetNetworkService returns name of networkService of clientConnection

type ClientConnectionState

type ClientConnectionState int8

ClientConnectionState describes state of ClientConnection

const (
	// ClientConnectionReady means connection is in state 'ready'
	ClientConnectionReady ClientConnectionState = 0

	// ClientConnectionRequesting means connection - is trying to be established for first time.
	ClientConnectionRequesting ClientConnectionState = 1

	// ClientConnectionBroken means connection failed requesting
	ClientConnectionBroken ClientConnectionState = 2

	// ClientConnectionHealingBegin means connection - is trying to be updated or to be healed.
	ClientConnectionHealingBegin ClientConnectionState = 3

	// ClientConnectionHealing means connection - is in progress of being updated or to be healed.
	ClientConnectionHealing ClientConnectionState = 4

	// ClientConnectionClosing means connection is started closing process
	ClientConnectionClosing ClientConnectionState = 5
)

type Endpoint

type Endpoint struct {
	Endpoint       *registry.NSERegistration
	SocketLocation string
	Workspace      string
}

Endpoint structure in Model that describes NetworkServiceEndpoint

func (*Endpoint) EndpointName

func (ep *Endpoint) EndpointName() string

EndpointName returns name of Endpoint

func (*Endpoint) NetworkServiceName

func (ep *Endpoint) NetworkServiceName() string

NetworkServiceName returns name of NetworkService of that Endpoint

type Forwarder

type Forwarder struct {
	RegisteredName       string
	SocketLocation       string
	LocalMechanisms      []*connection.Mechanism
	RemoteMechanisms     []*connection.Mechanism
	MechanismsConfigured bool
}

Forwarder structure in Model that describes forwarder

func (*Forwarder) SetLocalMechanisms

func (d *Forwarder) SetLocalMechanisms(mechanisms []*connection.Mechanism)

SetLocalMechanisms sets forwarder local mechanisms

func (*Forwarder) SetRemoteMechanisms

func (d *Forwarder) SetRemoteMechanisms(mechanisms []*connection.Mechanism)

SetRemoteMechanisms sets forwarder remote mechanisms

type ForwarderState

type ForwarderState int8

ForwarderState describes state of forwarder

const (
	// ForwarderStateNone means there is no active connection in forwarder
	ForwarderStateNone ForwarderState = 0 // In case forwarder is not yet configured for connection

	// ForwarderStateReady means there is an active connection in forwarder
	ForwarderStateReady ForwarderState = 1 // In case forwarder is configured for connection.
)

type Listener

type Listener interface {
	EndpointAdded(ctx context.Context, endpoint *Endpoint)
	EndpointUpdated(ctx context.Context, endpoint *Endpoint)
	EndpointDeleted(ctx context.Context, endpoint *Endpoint)

	ForwarderAdded(ctx context.Context, forwarder *Forwarder)
	ForwarderDeleted(ctx context.Context, forwarder *Forwarder)

	ClientConnectionAdded(ctx context.Context, clientConnection *ClientConnection)
	ClientConnectionDeleted(ctx context.Context, clientConnection *ClientConnection)
	ClientConnectionUpdated(ctx context.Context, old, new *ClientConnection)
}

Listener represent an interface for listening model changes

type ListenerImpl

type ListenerImpl struct{}

ListenerImpl is empty implementation of Listener

func (ListenerImpl) ClientConnectionAdded

func (ListenerImpl) ClientConnectionAdded(ctx context.Context, clientConnection *ClientConnection)

ClientConnectionAdded will be called when ClientConnection is added to model, accept pointer to copy

func (ListenerImpl) ClientConnectionDeleted

func (ListenerImpl) ClientConnectionDeleted(ctx context.Context, clientConnection *ClientConnection)

ClientConnectionDeleted will be called when ClientConnection in model is deleted

func (ListenerImpl) ClientConnectionUpdated

func (ListenerImpl) ClientConnectionUpdated(ctx context.Context, old, new *ClientConnection)

ClientConnectionUpdated will be called when ClientConnection in model is updated

func (ListenerImpl) EndpointAdded

func (ListenerImpl) EndpointAdded(ctx context.Context, endpoint *Endpoint)

EndpointAdded will be called when Endpoint is added to model, accept pointer to copy

func (ListenerImpl) EndpointDeleted

func (ListenerImpl) EndpointDeleted(ctx context.Context, endpoint *Endpoint)

EndpointDeleted will be called when Endpoint in model is deleted

func (ListenerImpl) EndpointUpdated

func (ListenerImpl) EndpointUpdated(ctx context.Context, endpoint *Endpoint)

EndpointUpdated will be called when Endpoint in model is updated

func (ListenerImpl) ForwarderAdded

func (ListenerImpl) ForwarderAdded(ctx context.Context, forwarder *Forwarder)

ForwarderAdded will be called when Forwarder is added to model, accept pointer to copy

func (ListenerImpl) ForwarderDeleted

func (ListenerImpl) ForwarderDeleted(ctx context.Context, forwarder *Forwarder)

ForwarderDeleted will be called when Forwarder in model is deleted

type Model

type Model interface {
	GetEndpointsByNetworkService(nsName string) []*Endpoint

	AddEndpoint(ctx context.Context, endpoint *Endpoint)
	GetEndpoint(name string) *Endpoint
	UpdateEndpoint(ctx context.Context, endpoint *Endpoint)
	DeleteEndpoint(ctx context.Context, name string)

	GetForwarder(name string) *Forwarder
	AddForwarder(ctx context.Context, forwarder *Forwarder)
	UpdateForwarder(ctx context.Context, forwarder *Forwarder)
	DeleteForwarder(ctx context.Context, name string)
	SelectForwarder(forwarderSelector func(dp *Forwarder) bool) (*Forwarder, error)

	AddClientConnection(ctx context.Context, clientConnection *ClientConnection)
	GetClientConnection(connectionID string) *ClientConnection
	GetAllClientConnections() []*ClientConnection
	UpdateClientConnection(ctx context.Context, clientConnection *ClientConnection)
	DeleteClientConnection(ctx context.Context, connectionID string)
	ApplyClientConnectionChanges(ctx context.Context, connectionID string, changeFunc func(*ClientConnection)) *ClientConnection

	ConnectionID() string
	CorrectIDGenerator(id string)

	AddListener(listener Listener)
	RemoveListener(listener Listener)
	ListenerCount() int

	SetNsm(nsm *registry.NetworkServiceManager)
	GetNsm() *registry.NetworkServiceManager

	GetSelector() selector.Selector
}

func NewModel

func NewModel() Model

NewModel returns new instance of Model

type ModificationHandler

type ModificationHandler struct {
	AddFunc    func(ctx context.Context, new interface{})
	UpdateFunc func(ctx context.Context, old interface{}, new interface{})
	DeleteFunc func(ctx context.Context, del interface{})
}

ModificationHandler aggregates handlers for particular events

Jump to

Keyboard shortcuts

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