mediator

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 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 ServiceMediator

ServiceMediator We use mediator pattern to wrap all the services, embed all the services in ServiceMediator, so that we can mediate all the methods of all the services transparently to the caller, for example, in other packages, we can use ServiceMediator.GetVPCsByNamespace directly. In startCRDController function, we register the CRDService to the ServiceMediator, since only one controller writes to its own store and other controllers read from the store, so we don't need lock here.

func (*ServiceMediator) GetAvailableSubnet

func (serviceMediator *ServiceMediator) GetAvailableSubnet(subnetSet *v1alpha1.SubnetSet) (string, error)

GetAvailableSubnet returns available Subnet under SubnetSet, and creates Subnet if necessary.

func (*ServiceMediator) GetNodeByName

func (serviceMediator *ServiceMediator) GetNodeByName(nodeName string) (*model.HostTransportNode, error)

func (*ServiceMediator) GetPortsOfSubnet

func (serviceMediator *ServiceMediator) GetPortsOfSubnet(nsxSubnetID string) (ports []model.VpcSubnetPort)

func (*ServiceMediator) GetVPCNetworkConfigByNamespace

func (m *ServiceMediator) GetVPCNetworkConfigByNamespace(ns string) *vpc.VPCNetworkConfigInfo

This method is used for subnet service since vpc network config contains default subnet size and default subnet access mode.

func (*ServiceMediator) ListVPCInfo

func (serviceMediator *ServiceMediator) ListVPCInfo(ns string) []common.VPCResourceInfo

ListVPCInfo is a common method, extracting the org, the project, and the vpc string from vpc path of the VPC model. VPC path looks like "/orgs/default/projects/project-1/vpcs/vpc-1", Since other modules only know namespace, this is the only entry point to get org and project. Currently, we only support one vpc per namespace, but we may support multiple vpcs per namespace in the future, so we return a slice of VPCInfo.

Jump to

Keyboard shortcuts

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