updater

package
v0.0.0-...-9634a1a Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResourceTypeToUpdatableFields = map[string][]string{
	"region":              {"name", "label"},
	"az":                  {"name", "label", "region"},
	"sub_domain":          {},
	"host":                {"name", "region", "az", "ip", "htype", "vcpu_num", "mem_total", "extra_info"},
	"vm":                  {"name", "state", "launch_server", "epc_id", "az", "region", "htype", "label"},
	"vpc":                 {"name", "cidr", "label", "tunnel_id", "region"},
	"network":             {"name", "label", "segmentation_id", "region", "az", "epc_id", "net_type", "tunnel_id"},
	"subnet":              {"name", "label"},
	"vrouter":             {"name", "label", "epc_id", "region"},
	"routing_table":       {"destination", "nexthop_type", "nexthop"},
	"dhcp_port":           {"name", "region", "az"},
	"vinterface":          {"name", "subnetid", "tap_mac", "region"},
	"wan_ip":              {"region"},
	"floating_ip":         {"region"},
	"security_group":      {"name", "label", "region"},
	"security_group_rule": {"priority", "ethertype", "remote_port_range", "remote", "local"},
	"vm_security_group":   {"priority"},
	"nat_gateway":         {"name", "floating_ips", "region"},
	"lb":                  {"name", "model", "vip", "region"},
	"lb_listener":         {"name", "port", "protocol", "ips", "snat_ips"},
	"lb_target_server":    {"port", "protocol", "ip"},
	"peer_connection":     {"name", "remote_region_id", "local_region_id"},
	"cen":                 {"name", "epc_ids"},
	"rds_instance":        {"name", "state", "series", "model", "region"},
	"redis_instance":      {"name", "state", "public_host", "region"},
	"pod_cluser":          {"name", "region", "az", "cluster_name"},
	"pod_node":            {"state", "az", "region", "vcpu_num", "mem_total"},
	"pod_namespace":       {"region", "az"},
	"pod_ingress":         {"name", "region", "az"},
	"pod_service":         {"name", "selector", "pod_ingress_id", "service_cluster_ip", "region", "az"},
	"pod_service_port":    {"name"},
	"pod_group":           {"name", "pod_num", "label", "region", "az", "type"},
	"pod_group_port":      {"name"},
	"pod_replica_set":     {"name", "pod_num", "region", "az"},
	"pod":                 {"name", "state", "region", "az", "epc_id", "pod_rs_id", "pod_node_id", "created_at"},
}

Functions

This section is empty.

Types

type AZ

type AZ struct {
	UpdaterBase[cloudmodel.AZ, mysql.AZ, *cache.AZ]
}

func NewAZ

func NewAZ(wholeCache *cache.Cache, cloudData []cloudmodel.AZ) *AZ

type CEN

type CEN struct {
	UpdaterBase[cloudmodel.CEN, mysql.CEN, *cache.CEN]
}

func NewCEN

func NewCEN(wholeCache *cache.Cache, cloudData []cloudmodel.CEN) *CEN

type CacheHandler

type CacheHandler[CT constraint.CloudModel, MT constraint.MySQLModel, BT constraint.DiffBase[MT]] interface {
	// contains filtered or unexported methods
}

type Callbacks

type Callbacks[CT constraint.CloudModel, MT constraint.MySQLModel, BT constraint.DiffBase[MT]] struct {
	// contains filtered or unexported fields
}

type DHCPPort

type DHCPPort struct {
	UpdaterBase[cloudmodel.DHCPPort, mysql.DHCPPort, *cache.DHCPPort]
}

func NewDHCPPort

func NewDHCPPort(wholeCache *cache.Cache, cloudData []cloudmodel.DHCPPort) *DHCPPort

type DataGenerator

type DataGenerator[CT constraint.CloudModel, MT constraint.MySQLModel, BT constraint.DiffBase[MT]] interface {
	// contains filtered or unexported methods
}

type FloatingIP

func NewFloatingIP

func NewFloatingIP(wholeCache *cache.Cache, cloudData []cloudmodel.FloatingIP) *FloatingIP

type Host

type Host struct {
	UpdaterBase[cloudmodel.Host, mysql.Host, *cache.Host]
}

func NewHost

func NewHost(wholeCache *cache.Cache, cloudData []cloudmodel.Host) *Host

type IP

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

func NewIP

func NewIP(cache *cache.Cache, cloudData []cloudmodel.IP, domainToolDataSet *cache.ToolDataSet) *IP

func (*IP) GetLANIP

func (i *IP) GetLANIP() *LANIP

func (*IP) GetWANIP

func (i *IP) GetWANIP() *WANIP

func (*IP) HandleAddAndUpdate

func (i *IP) HandleAddAndUpdate()

func (*IP) HandleDelete

func (i *IP) HandleDelete()

type LANIP

type LANIP struct {
	UpdaterBase[cloudmodel.IP, mysql.LANIP, *cache.LANIP]
}

func NewLANIP

func NewLANIP(wholeCache *cache.Cache, domainToolDataSet *cache.ToolDataSet) *LANIP

func (*LANIP) SetCloudData

func (i *LANIP) SetCloudData(cloudData []cloudmodel.IP)

type LB

type LB struct {
	UpdaterBase[cloudmodel.LB, mysql.LB, *cache.LB]
}

func NewLB

func NewLB(wholeCache *cache.Cache, cloudData []cloudmodel.LB) *LB

type LBListener

func NewLBListener

func NewLBListener(wholeCache *cache.Cache, cloudData []cloudmodel.LBListener) *LBListener

type LBTargetServer

func NewLBTargetServer

func NewLBTargetServer(wholeCache *cache.Cache, cloudData []cloudmodel.LBTargetServer) *LBTargetServer

type LBVMConnection

func NewLBVMConnection

func NewLBVMConnection(wholeCache *cache.Cache, cloudData []cloudmodel.LBVMConnection) *LBVMConnection

type NATGateway

func NewNATGateway

func NewNATGateway(wholeCache *cache.Cache, cloudData []cloudmodel.NATGateway) *NATGateway

type NATRule

type NATRule struct {
	UpdaterBase[cloudmodel.NATRule, mysql.NATRule, *cache.NATRule]
}

func NewNATRule

func NewNATRule(wholeCache *cache.Cache, cloudData []cloudmodel.NATRule) *NATRule

type NATVMConnection

func NewNATVMConnection

func NewNATVMConnection(wholeCache *cache.Cache, cloudData []cloudmodel.NATVMConnection) *NATVMConnection

type Network

type Network struct {
	UpdaterBase[cloudmodel.Network, mysql.Network, *cache.Network]
}

func NewNetwork

func NewNetwork(wholeCache *cache.Cache, cloudData []cloudmodel.Network) *Network

type PeerConnection

func NewPeerConnection

func NewPeerConnection(wholeCache *cache.Cache, cloudData []cloudmodel.PeerConnection) *PeerConnection

type Pod

type Pod struct {
	UpdaterBase[cloudmodel.Pod, mysql.Pod, *cache.Pod]
}

func NewPod

func NewPod(wholeCache *cache.Cache, cloudData []cloudmodel.Pod) *Pod

type PodCluster

func NewPodCluster

func NewPodCluster(wholeCache *cache.Cache, cloudData []cloudmodel.PodCluster) *PodCluster

type PodGroup

type PodGroup struct {
	UpdaterBase[cloudmodel.PodGroup, mysql.PodGroup, *cache.PodGroup]
}

func NewPodGroup

func NewPodGroup(wholeCache *cache.Cache, cloudData []cloudmodel.PodGroup) *PodGroup

type PodGroupPort

func NewPodGroupPort

func NewPodGroupPort(wholeCache *cache.Cache, cloudData []cloudmodel.PodGroupPort) *PodGroupPort

type PodIngress

func NewPodIngress

func NewPodIngress(wholeCache *cache.Cache, cloudData []cloudmodel.PodIngress) *PodIngress

type PodIngressRule

func NewPodIngressRule

func NewPodIngressRule(wholeCache *cache.Cache, cloudData []cloudmodel.PodIngressRule) *PodIngressRule

type PodNamespace

func NewPodNamespace

func NewPodNamespace(wholeCache *cache.Cache, cloudData []cloudmodel.PodNamespace) *PodNamespace

type PodNode

type PodNode struct {
	UpdaterBase[cloudmodel.PodNode, mysql.PodNode, *cache.PodNode]
}

func NewPodNode

func NewPodNode(wholeCache *cache.Cache, cloudData []cloudmodel.PodNode) *PodNode

type PodReplicaSet

func NewPodReplicaSet

func NewPodReplicaSet(wholeCache *cache.Cache, cloudData []cloudmodel.PodReplicaSet) *PodReplicaSet

type PodService

func NewPodService

func NewPodService(wholeCache *cache.Cache, cloudData []cloudmodel.PodService) *PodService

type PodServicePort

func NewPodServicePort

func NewPodServicePort(wholeCache *cache.Cache, cloudData []cloudmodel.PodServicePort) *PodServicePort

type Process

type Process struct {
	UpdaterBase[cloudmodel.Process, mysql.Process, *cache.Process]
}

func NewProcess

func NewProcess(wholeCache *cache.Cache, cloudData []cloudmodel.Process) *Process

type RDSInstance

func NewRDSInstance

func NewRDSInstance(wholeCache *cache.Cache, cloudData []cloudmodel.RDSInstance) *RDSInstance

type RedisInstance

func NewRedisInstance

func NewRedisInstance(wholeCache *cache.Cache, cloudData []cloudmodel.RedisInstance) *RedisInstance

type Region

type Region struct {
	UpdaterBase[cloudmodel.Region, mysql.Region, *cache.Region]
}

func NewRegion

func NewRegion(wholeCache *cache.Cache, cloudData []cloudmodel.Region) *Region

type ResourceUpdater

type ResourceUpdater interface {
	// 以资源的lcuuid为key,逐一检查cloud数据
	// 若cache的diff base中不存在,则添加
	// 若cache的diff base中存在,基于可更新字段,检查cloud数据是否发生变化,若发生变化,则更新;
	// 无论已存在资源有无变化,根据cache的sequence更新的diff base中的sequence,用于标记资源是否需要被删除
	HandleAddAndUpdate()
	// 逐一检查diff base中的资源,若sequence不等于cache中的sequence,则删除
	HandleDelete()
}

ResourceUpdater 实现资源进行新旧数据比对,并根据比对结果增删改资源

type RoutingTable

func NewRoutingTable

func NewRoutingTable(wholeCache *cache.Cache, cloudData []cloudmodel.RoutingTable) *RoutingTable

type SecurityGroup

func NewSecurityGroup

func NewSecurityGroup(wholeCache *cache.Cache, cloudData []cloudmodel.SecurityGroup) *SecurityGroup

type SecurityGroupRule

func NewSecurityGroupRule

func NewSecurityGroupRule(wholeCache *cache.Cache, cloudData []cloudmodel.SecurityGroupRule) *SecurityGroupRule

type SubDomain

func NewSubDomain

func NewSubDomain(wholeCache *cache.Cache, cloudData []cloudmodel.SubDomain) *SubDomain

type Subnet

type Subnet struct {
	UpdaterBase[cloudmodel.Subnet, mysql.Subnet, *cache.Subnet]
}

func NewSubnet

func NewSubnet(wholeCache *cache.Cache, cloudData []cloudmodel.Subnet) *Subnet

type UpdaterBase

type UpdaterBase[CT constraint.CloudModel, MT constraint.MySQLModel, BT constraint.DiffBase[MT]] struct {
	// contains filtered or unexported fields
}

func (*UpdaterBase[CT, MT, BT]) HandleAddAndUpdate

func (u *UpdaterBase[CT, MT, BT]) HandleAddAndUpdate()

func (*UpdaterBase[CT, MT, BT]) HandleDelete

func (u *UpdaterBase[CT, MT, BT]) HandleDelete()

func (*UpdaterBase[CT, MT, BT]) RegisterCallbacks

func (u *UpdaterBase[CT, MT, BT]) RegisterCallbacks(onAdded func(addedDBItems []*MT), onUpdated func(cloudItem *CT, diffBaseItem BT), onDeleted func(lcuuids []string))

type VInterface

func NewVInterface

func NewVInterface(wholeCache *cache.Cache, cloudData []cloudmodel.VInterface, domainToolDataSet *cache.ToolDataSet) *VInterface

type VM

type VM struct {
	UpdaterBase[cloudmodel.VM, mysql.VM, *cache.VM]
}

func NewVM

func NewVM(wholeCache *cache.Cache, cloudData []cloudmodel.VM) *VM

type VMSecurityGroup

func NewVMSecurityGroup

func NewVMSecurityGroup(wholeCache *cache.Cache, cloudData []cloudmodel.VMSecurityGroup) *VMSecurityGroup

type VPC

type VPC struct {
	UpdaterBase[cloudmodel.VPC, mysql.VPC, *cache.VPC]
}

func NewVPC

func NewVPC(wholeCache *cache.Cache, cloudData []cloudmodel.VPC) *VPC

type VRouter

type VRouter struct {
	UpdaterBase[cloudmodel.VRouter, mysql.VRouter, *cache.VRouter]
}

func NewVRouter

func NewVRouter(wholeCache *cache.Cache, cloudData []cloudmodel.VRouter) *VRouter

type WANIP

type WANIP struct {
	UpdaterBase[cloudmodel.IP, mysql.WANIP, *cache.WANIP]
}

func NewWANIP

func NewWANIP(wholeCache *cache.Cache, domainToolDataSet *cache.ToolDataSet) *WANIP

func (*WANIP) SetCloudData

func (i *WANIP) SetCloudData(cloudData []cloudmodel.IP)

Jump to

Keyboard shortcuts

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