heal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Overview

Package heal provides a chain element that carries out proper nsm healing from client to endpoint

Code generated by "-output connection_info_map.gen.go -type connectionInfoMap<string,*connectionInfo> -output connection_info_map.gen.go -type connectionInfoMap<string,*connectionInfo>"; DO NOT EDIT.

Code generated by "-output context_wrapper_map.gen.go -type ctxWrapperMap<string,*ctxWrapper> -output context_wrapper_map.gen.go -type ctxWrapperMap<string,*ctxWrapper>"; DO NOT EDIT.

Package heal provides a chain element that carries out proper nsm healing from client to endpoint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

NewClient - creates a new networkservice.NetworkServiceClient chain element that monitors its connections' state

and calls heal server in case connection breaks if heal server is present in the chain
- ctx - context for the lifecycle of the *Client* itself.  Cancel when discarding the client.
- cc  - MonitorConnectionClient that will be used to watch for connection confirmations and breakages.

func NewServer

NewServer - creates a new networkservice.NetworkServiceServer chain element that implements the healing algorithm

Types

type OnRestore

type OnRestore int

OnRestore is an action that should be performed on restore request

const (
	// OnRestoreRestore - restore should be performed
	OnRestoreRestore OnRestore = iota
	// OnRestoreHeal - heal should be performed
	OnRestoreHeal
	// OnRestoreIgnore - restore request should be ignored
	OnRestoreIgnore
)

type Option

type Option func(healOpts *healOptions)

Option is an option pattern for heal server

func WithOnHeal

func WithOnHeal(onHeal *networkservice.NetworkServiceClient) Option

WithOnHeal - sets client used 'onHeal'. * If we detect we need to heal, onHeal.Request is used to heal. * If we can't heal connection, onHeal.Close will be called. * If onHeal is nil, then we simply set onHeal to this client chain element. Since networkservice.NetworkServiceClient is an interface (and thus a pointer) *networkservice.NetworkServiceClient is a double pointer. Meaning it points to a place that points to a place that implements networkservice.NetworkServiceClient. This is done because when we use heal.NewClient as part of a chain, we may not *have* a pointer to this chain.

func WithOnRestore

func WithOnRestore(onRestore OnRestore) Option

WithOnRestore sets on restore action. Default `OnRestoreHeal`. IMPORTANT: should be set `OnRestoreIgnore` for the Forwarder, because it results in NSMgr doesn't understanding that Request is coming from Forwarder (https://github.com/networkservicemesh/sdk/issues/970).

func WithRestoreTimeout

func WithRestoreTimeout(restoreTimeout time.Duration) Option

WithRestoreTimeout sets restore timeout. Default `1m`.

Jump to

Keyboard shortcuts

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