pubsub

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PubSubTypeAllDomains            = "all_domains"
	PubSubTypeDomain                = "domain"
	PubSubTypeRegion                = common.RESOURCE_TYPE_REGION_EN
	PubSubTypeAZ                    = common.RESOURCE_TYPE_AZ_EN
	PubSubTypeSubDomain             = common.RESOURCE_TYPE_SUB_DOMAIN_EN
	PubSubTypeHost                  = common.RESOURCE_TYPE_HOST_EN
	PubSubTypeVM                    = common.RESOURCE_TYPE_VM_EN
	PubSubTypeVMPodNodeConnection   = common.RESOURCE_TYPE_VM_POD_NODE_CONNECTION_EN
	PubSubTypeVPC                   = common.RESOURCE_TYPE_VPC_EN
	PubSubTypeNetwork               = common.RESOURCE_TYPE_NETWORK_EN
	PubSubTypeSubnet                = common.RESOURCE_TYPE_SUBNET_EN
	PubSubTypeVRouter               = common.RESOURCE_TYPE_VROUTER_EN
	PubSubTypeRoutingTable          = common.RESOURCE_TYPE_ROUTING_TABLE_EN
	PubSubTypeDHCPPort              = common.RESOURCE_TYPE_DHCP_PORT_EN
	PubSubTypeVInterface            = common.RESOURCE_TYPE_VINTERFACE_EN
	PubSubTypeFloatingIP            = common.RESOURCE_TYPE_FLOATING_IP_EN
	PubSubTypeWANIP                 = common.RESOURCE_TYPE_WAN_IP_EN
	PubSubTypeLANIP                 = common.RESOURCE_TYPE_LAN_IP_EN
	PubSubTypeVIP                   = common.RESOURCE_TYPE_VIP_EN
	PubSubTypeNATGateway            = common.RESOURCE_TYPE_NAT_GATEWAY_EN
	PubSubTypeNATRule               = common.RESOURCE_TYPE_NAT_RULE_EN
	PubSubTypeNATVMConnection       = common.RESOURCE_TYPE_NAT_VM_CONNECTION_EN
	PubSubTypeLB                    = common.RESOURCE_TYPE_LB_EN
	PubSubTypeLBListener            = common.RESOURCE_TYPE_LB_LISTENER_EN
	PubSubTypeLBTargetServer        = common.RESOURCE_TYPE_LB_TARGET_SERVER_EN
	PubSubTypeLBVMConnection        = common.RESOURCE_TYPE_LB_VM_CONNECTION_EN
	PubSubTypePeerConnection        = common.RESOURCE_TYPE_PEER_CONNECTION_EN
	PubSubTypeCEN                   = common.RESOURCE_TYPE_CEN_EN
	PubSubTypeRDSInstance           = common.RESOURCE_TYPE_RDS_INSTANCE_EN
	PubSubTypeRedisInstance         = common.RESOURCE_TYPE_REDIS_INSTANCE_EN
	PubSubTypePodCluster            = common.RESOURCE_TYPE_POD_CLUSTER_EN
	PubSubTypePodNode               = common.RESOURCE_TYPE_POD_NODE_EN
	PubSubTypePodNamespace          = common.RESOURCE_TYPE_POD_NAMESPACE_EN
	PubSubTypePodIngress            = common.RESOURCE_TYPE_POD_INGRESS_EN
	PubSubTypePodIngressRule        = common.RESOURCE_TYPE_POD_INGRESS_RULE_EN
	PubSubTypePodIngressRuleBackend = common.RESOURCE_TYPE_POD_INGRESS_RULE_BACKEND_EN
	PubSubTypePodService            = common.RESOURCE_TYPE_POD_SERVICE_EN
	PubSubTypePodServicePort        = common.RESOURCE_TYPE_POD_SERVICE_PORT_EN
	PubSubTypePodGroup              = common.RESOURCE_TYPE_POD_GROUP_EN
	PubSubTypePodGroupPort          = common.RESOURCE_TYPE_POD_GROUP_PORT_EN
	PubSubTypePodReplicaSet         = common.RESOURCE_TYPE_POD_REPLICA_SET_EN
	PubSubTypePod                   = common.RESOURCE_TYPE_POD_EN
	PubSubTypeProcess               = common.RESOURCE_TYPE_PROCESS_EN
)
View Source
const (
	TopicResourceChanged              = iota // subscribe to this topic to get notification of resource changed
	TopicResourceBatchAddedMySQL             // subscribe to this topic to get MySQL model data of resource batch added
	TopicResourceUpdatedFields               // subscribe to this topic to get message update model data of resource updated
	TopicResourceUpdatedMessageUpdate        // subscribe to this topic to get message update model data of resource updated
	TopicResourceBatchDeletedLcuuid          // subscribe to this topic to get lcuuids of resource batch deleted
	TopicResourceBatchDeletedMySQL           // subscribe to this topic to get MySQL model data of resource batch deleted
)

Variables

This section is empty.

Functions

func GetPubSub

func GetPubSub(pubSubType string) interface{}

func Subscribe

func Subscribe(pubSubType string, topic int, subscriber interface{}) error

Subscribe 提供订阅接口 pubSubType: 消息中心类型 topic: 主题 subscriber: 订阅者

Types

type Domain

type Domain struct {
	PubSubComponent
}

func NewDomain

func NewDomain() *Domain

type DomainPubSub

type DomainPubSub interface {
	PubSub
	PublishChange(*message.Metadata) // publish any change of the cloud platform, only notify the fact that the cloud platform has been changed, without specific changed data.
}

PubSub interface for the whole cloud platform

type Manager

type Manager struct {
	TypeToPubSub map[string]PubSub
}

func GetManager

func GetManager() *Manager

func (*Manager) GetPubSub

func (m *Manager) GetPubSub(pubSubType string) PubSub

func (*Manager) Subscribe

func (m *Manager) Subscribe(pubSubType string, topic int, subscriber interface{}) error

type PubSub

type PubSub interface {
	Subscribe(topic int, subscriber interface{})
	Unsubscribe(topic int, subscriber interface{})
}

type PubSubComponent

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

func (*PubSubComponent) Subscribe

func (p *PubSubComponent) Subscribe(topic int, subscriber interface{})

func (*PubSubComponent) Unsubscribe

func (p *PubSubComponent) Unsubscribe(topic int, subscriber interface{})

type ResourceBatchAddedSubscriber

type ResourceBatchAddedSubscriber interface {
	OnResourceBatchAdded(md *message.Metadata, msg interface{})
}

type ResourceBatchDeletedSubscriber

type ResourceBatchDeletedSubscriber interface {
	OnResourceBatchDeleted(md *message.Metadata, msg interface{})
}

type ResourceChangedSubscriber

type ResourceChangedSubscriber interface {
	OnResourceChanged(md *message.Metadata, msg interface{})
}

type ResourcePubSub

type ResourcePubSub[
	MAPT constraint.AddPtr[MAT],
	MAT constraint.Add,
	MUPT constraint.UpdatePtr[MUT],
	MUT constraint.Update,
	MFUPT constraint.FieldsUpdatePtr[MFUT],
	MFUT constraint.FieldsUpdate,
	MDPT constraint.DeletePtr[MDT],
	MDT constraint.Delete,
] interface {
	PubSub
	PublishChange(*message.Metadata)             // publish any change of the resource, only notify the fact that some of the whole resource has been changed, without specific changed data
	PublishBatchAdded(*message.Metadata, MAPT)   // publish resource batch added notification, including specific data
	PublishUpdated(*message.Metadata, MUPT)      // publish resource updated notification, including specific data
	PublishBatchDeleted(*message.Metadata, MDPT) // publish resource batch deleted notification, including specific data
}

Pubsub interface for a specific resource

type ResourcePubSubComponent

type ResourcePubSubComponent[
	MAPT constraint.AddPtr[MAT],
	MAT constraint.Add,
	MUPT constraint.UpdatePtr[MUT],
	MUT constraint.Update,
	MFUPT constraint.FieldsUpdatePtr[MFUT],
	MFUT constraint.FieldsUpdate,
	MDPT constraint.DeletePtr[MDT],
	MDT constraint.Delete,
] struct {
	PubSubComponent
	// contains filtered or unexported fields
}

func (*ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishBatchAdded

func (p *ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishBatchAdded(md *message.Metadata, msg MAPT)

func (*ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishBatchDeleted

func (p *ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishBatchDeleted(md *message.Metadata, msg MDPT)

func (*ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishChange

func (p *ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishChange(md *message.Metadata)

func (*ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishUpdated

func (p *ResourcePubSubComponent[MAPT, MAT, MUPT, MUT, MFUPT, MFUT, MDPT, MDT]) PublishUpdated(md *message.Metadata, msg MUPT)

type ResourceUpdatedSubscriber

type ResourceUpdatedSubscriber interface {
	OnResourceUpdated(md *message.Metadata, msg interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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