nacos

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigMapGVK = schema.GroupVersionKind{Group: "", Version: "v1", Kind: "ConfigMap"}
)

Functions

func CalcMd5

func CalcMd5(s string) string

func GetNacosConfigurationUniKey

func GetNacosConfigurationUniKey(namespace, group, dataId string) string

func GetSyncStatusByDataId

func GetSyncStatusByDataId(statuses []nacosiov1.SyncStatus, dataId string) *nacosiov1.SyncStatus

func RegisterObjectWrapper

func RegisterObjectWrapper(targetGVK string, fn NewObjectWrapperFn)

func RegisterObjectWrapperIfAbsent

func RegisterObjectWrapperIfAbsent(targetGVK string, fn NewObjectWrapperFn)

func RemoveSyncStatus

func RemoveSyncStatus(dc *nacosiov1.DynamicConfiguration, dataId string)

func StringSliceContains

func StringSliceContains(arr []string, item string) bool

func UpdateSyncStatus

func UpdateSyncStatus(dc *nacosiov1.DynamicConfiguration, dataId, md5, from string, t metav1.Time, ready bool, message string)

func UpdateSyncStatusIfAbsent

func UpdateSyncStatusIfAbsent(dc *nacosiov1.DynamicConfiguration, dataId, md5, from string, t metav1.Time, ready bool, message string)

Types

type ConfigMapWrapper

type ConfigMapWrapper struct {
	ObjectRef *v1.ObjectReference
	// contains filtered or unexported fields
}

func (*ConfigMapWrapper) DeleteContent

func (cmw *ConfigMapWrapper) DeleteContent(dataId string) error

func (*ConfigMapWrapper) Flush

func (cmw *ConfigMapWrapper) Flush() error

func (*ConfigMapWrapper) GetContent

func (cmw *ConfigMapWrapper) GetContent(dataId string) (string, bool, error)

func (*ConfigMapWrapper) InjectLabels

func (cmw *ConfigMapWrapper) InjectLabels(labels map[string]string)

func (*ConfigMapWrapper) Reload

func (cmw *ConfigMapWrapper) Reload() error

func (*ConfigMapWrapper) StoreAllContent

func (cmw *ConfigMapWrapper) StoreAllContent(dataMap map[string]string) (bool, error)

func (*ConfigMapWrapper) StoreContent

func (cmw *ConfigMapWrapper) StoreContent(dataId string, content string) error

type DataId2DCMappings

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

func NewDataId2DCMappings

func NewDataId2DCMappings() *DataId2DCMappings

func (*DataId2DCMappings) AddMapping

func (d *DataId2DCMappings) AddMapping(namespaceId, group, dataId string, nn types.NamespacedName)

func (*DataId2DCMappings) GetDCList

func (d *DataId2DCMappings) GetDCList(namespaceId, group, dataId string) []types.NamespacedName

func (*DataId2DCMappings) HasMapping

func (d *DataId2DCMappings) HasMapping(namespaceId, group, dataId string, nn types.NamespacedName) bool

func (*DataId2DCMappings) RemoveMapping

func (d *DataId2DCMappings) RemoveMapping(namespaceId, group, dataId string, nn types.NamespacedName)

type DefaultServer2ClusterCallback

type DefaultServer2ClusterCallback struct {
	client.Client
	// contains filtered or unexported fields
}

func (*DefaultServer2ClusterCallback) Callback

func (cb *DefaultServer2ClusterCallback) Callback(namespace, group, dataId, content string)

func (*DefaultServer2ClusterCallback) CallbackWithContext

func (cb *DefaultServer2ClusterCallback) CallbackWithContext(ctx context.Context, namespace, group, dataId, content string)

type LockManager

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

func NewLockManager

func NewLockManager() *LockManager

func (*LockManager) DelLock

func (lm *LockManager) DelLock(key string)

func (*LockManager) GetLock

func (lm *LockManager) GetLock(key string) *sync.Mutex

func (*LockManager) HasLock

func (lm *LockManager) HasLock(key string) bool

type ObjectReferenceWrapper

type ObjectReferenceWrapper interface {
	//GetContent return content by dataId
	GetContent(dataId string) (string, bool, error)
	//StoreContent store content by dataId, return err if happened
	StoreContent(dataId string, content string) error
	//StoreAllContent store a map with dataId as key and content as value, return true if any content changed and error
	StoreAllContent(map[string]string) (bool, error)
	//DeleteContent remove a dataId
	DeleteContent(dataId string) error
	//InjectLabels to ObjectReference
	InjectLabels(map[string]string)
	//Flush write all content to ObjectReference
	Flush() error
	//Reload load ObjectReference, create it when not found
	Reload() error
}

func NewObjectReferenceWrapper

func NewObjectReferenceWrapper(cs *kubernetes.Clientset, owner client.Object, objRef *v1.ObjectReference) (ObjectReferenceWrapper, error)

type Server2ClusterCallback

type Server2ClusterCallback interface {
	Callback(namespace, group, dataId, content string)
	CallbackWithContext(ctx context.Context, namespace, group, dataId, content string)
}

func NewDefaultServer2ClusterCallback

func NewDefaultServer2ClusterCallback(c client.Client, cs *kubernetes.Clientset, mappings *DataId2DCMappings, locks *LockManager) Server2ClusterCallback

type SyncConfigOptions

type SyncConfigOptions struct {
	ConfigClient nacosclient.NacosConfigClient
	Callback     Server2ClusterCallback
	Mappings     *DataId2DCMappings
	Locks        *LockManager
}

type SyncConfigurationController

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

func (*SyncConfigurationController) Finalize

func (*SyncConfigurationController) SyncDynamicConfiguration

func (scc *SyncConfigurationController) SyncDynamicConfiguration(ctx context.Context, dc *nacosiov1.DynamicConfiguration) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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