sharedstate

package
v2.4.10-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 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 State

type State struct {
	LoginExecutor     userd_auth.LoginExecutor
	UserNotifications broadcastqueue.BroadcastQueue
	// contains filtered or unexported fields
}

func NewState

func NewState(ctx context.Context, procName string) (*State, error)

func (*State) GetCloudAPIKey

func (s *State) GetCloudAPIKey(ctx context.Context, desc string, autoLogin bool) (string, error)

func (*State) GetCloudUserInfo added in v2.3.7

func (s *State) GetCloudUserInfo(ctx context.Context, refresh, autoLogin bool) (*authdata.UserInfo, error)

func (*State) GetClusterBlocking

func (s *State) GetClusterBlocking(ctx context.Context) (*userd_k8s.Cluster, error)

func (*State) GetClusterNonBlocking

func (s *State) GetClusterNonBlocking() *userd_k8s.Cluster

func (*State) GetTrafficManagerBlocking

func (s *State) GetTrafficManagerBlocking(ctx context.Context) (TrafficManager, error)

func (*State) GetTrafficManagerNonBlocking

func (s *State) GetTrafficManagerNonBlocking() TrafficManager

func (*State) GetTrafficManagerReadyToIntercept added in v2.4.10

func (s *State) GetTrafficManagerReadyToIntercept() (*connector.InterceptResult, TrafficManager)

func (*State) MaybeSetCluster

func (s *State) MaybeSetCluster(cluster *userd_k8s.Cluster) bool

func (*State) MaybeSetTrafficManager

func (s *State) MaybeSetTrafficManager(mgr TrafficManager) bool

func (*State) SetLogLevel added in v2.4.2

func (s *State) SetLogLevel(ctx context.Context, level string, duration time.Duration) error

type TrafficManager

type TrafficManager interface {
	// Run is the "main" method that runs in a dedicated persistent goroutine.
	Run(context.Context) error

	// GetClientBlocking returns a client object for talking to the manager.  If communication
	// is not yet established, GetClientBlocking blocks until it is (or until the Context is
	// canceled).  Error is non-nil if either there is an error establishing communication or if
	// the context is canceled.
	GetClientBlocking(ctx context.Context) (manager.ManagerClient, error)

	// GetClientNonBlocking is similar to GetClientBlocking, but if communication is not yet
	// established then it immediately returns (nil, nil) rather than blocking; this is the only
	// scenario in which both are nil.
	GetClientNonBlocking() (manager.ManagerClient, error)

	// CanIntercept checks if it is possible to create an intercept for the given request. The intercept can proceed
	// only if the returned rpc.InterceptResult is nil. The returned kates.Object is either nil, indicating a local
	// intercept, or the workload for the intercept.
	CanIntercept(context.Context, *connector.CreateInterceptRequest) (*connector.InterceptResult, kates.Object)

	AddIntercept(context.Context, *connector.CreateInterceptRequest) (*connector.InterceptResult, error)

	RemoveIntercept(context.Context, string) error
	WorkloadInfoSnapshot(context.Context, *connector.ListRequest) *connector.WorkloadInfoSnapshot
	Uninstall(context.Context, *connector.UninstallRequest) (*connector.UninstallResult, error)
	SetStatus(context.Context, *connector.ConnectInfo)
}

A TrafficManager implementation is essentially the goroutine that handles communication with the in-cluster Traffic Manager. It includes a "Run" method which is what runs in the goroutine, and several other methods to communicate with that goroutine.

Jump to

Keyboard shortcuts

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