config

package
v7.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

  • Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

* Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at

* http://www.apache.org/licenses/LICENSE-2.0

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateLogConfigHash

func GenerateLogConfigHash(createHashLog map[string]string) ([16]byte, error)

generate md5 hash of key value pairs appended into a single string in order by key name

func StartLogFeaturesConfigProcessing

func StartLogFeaturesConfigProcessing(cm *ConfigManager, ctx context.Context)

StartLogFeaturesConfigProcessing persists initial config of Log Features into Config Store before starting the loading and processing of Configuration updates

func StartLogLevelConfigProcessing

func StartLogLevelConfigProcessing(cm *ConfigManager, ctx context.Context)

StartLogLevelConfigProcessing initialize component config and global config Then, it persists initial default Loglevels into Config Store before starting the loading and processing of all Log Configuration

Types

type ChangeEvent

type ChangeEvent int

ChangeEvent represents the event recieved from watch For example, Put Event

const (
	Put ChangeEvent = iota
	Delete
)

func (ChangeEvent) String

func (ce ChangeEvent) String() string

type ComponentConfig

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

ComponentConfig represents a category of configuration for a specific VOLTHA component type stored in a persistent storage pointed to by Config Manager For example, one ComponentConfig instance will be created for loglevel config type for rw-core component while another ComponentConfig instance will refer to connection config type for same rw-core component. So, there can be multiple ComponentConfig instance created per component pointing to different category of configuration.

Configuration pointed to be by ComponentConfig is stored in kvstore as a list of key/value pairs under the hierarchical tree with following base path <Backend Prefix Path>/<Config Prefix>/<Component Name>/<Config Type>/

For example, rw-core ComponentConfig for loglevel config entries will be stored under following path /voltha/service/config/rw-core/loglevel/

func (*ComponentConfig) Delete

func (c *ComponentConfig) Delete(ctx context.Context, configKey string) error

func (*ComponentConfig) MonitorForConfigChange

func (c *ComponentConfig) MonitorForConfigChange(ctx context.Context) chan *ConfigChangeEvent

MonitorForConfigChange watch on the subkeys for the given key Any changes to the subkeys for the given key will return an event channel Then Event channel will be processed and new event channel with required values will be created and return For example, rw-core will be watching on <Backend Prefix Path>/<Config Prefix>/<Component Name>/<Config Type>/ will return an event channel for PUT,DELETE eventType. Then values from event channel will be processed and stored in kvStoreEventChan.

func (*ComponentConfig) Retrieve

func (c *ComponentConfig) Retrieve(ctx context.Context, configKey string) (string, error)

Retrieves value of a specific config key. Value of key is returned in String format

func (*ComponentConfig) RetrieveAll

func (c *ComponentConfig) RetrieveAll(ctx context.Context) (map[string]string, error)

func (*ComponentConfig) Save

func (c *ComponentConfig) Save(ctx context.Context, configKey string, configValue string) error

type ComponentLogController

type ComponentLogController struct {
	ComponentName string

	GlobalConfig *ComponentConfig
	// contains filtered or unexported fields
}

ComponentLogController represents a Configuration for Logging Config of specific Voltha component type It stores ComponentConfig and GlobalConfig of loglevel config of specific Voltha component type For example,ComponentLogController instance will be created for rw-core component

func NewComponentLogController

func NewComponentLogController(ctx context.Context, cm *ConfigManager) (*ComponentLogController, error)

type ComponentLogFeaturesController

type ComponentLogFeaturesController struct {
	ComponentName string
	// contains filtered or unexported fields
}

ComponentLogFeatureController represents Configuration for Logging related features of Tracing and Log Correlation of specific Voltha component.

func NewComponentLogFeaturesController

func NewComponentLogFeaturesController(ctx context.Context, cm *ConfigManager) (*ComponentLogFeaturesController, error)

type ConfigChangeEvent

type ConfigChangeEvent struct {
	ChangeType      ChangeEvent
	ConfigAttribute string
}

ConfigChangeEvent represents config for the events recieved from watch For example,ChangeType is Put ,ConfigAttribute default

type ConfigManager

type ConfigManager struct {
	Backend               *db.Backend
	KVStoreConfigPrefix   string
	KVStoreDataPathPrefix string
}

ConfigManager is a wrapper over Backend to maintain Configuration of voltha components in kvstore based persistent storage

func NewConfigManager

func NewConfigManager(ctx context.Context, kvClient kvstore.Client, kvStoreType, kvStoreAddress string, kvStoreTimeout time.Duration) *ConfigManager

func (*ConfigManager) InitComponentConfig

func (cm *ConfigManager) InitComponentConfig(componentLabel string, configType ConfigType) *ComponentConfig

Initialize the component config

func (*ConfigManager) RetrieveComponentList

func (c *ConfigManager) RetrieveComponentList(ctx context.Context, configType ConfigType) ([]string, error)

RetrieveComponentList list the component Names for which loglevel is stored in kvstore

type ConfigType

type ConfigType int

ConfigType represents the type for which config is created inside the kvstore For example, loglevel

const (
	ConfigTypeLogLevel ConfigType = iota
	ConfigTypeMetadata
	ConfigTypeKafka
	ConfigTypeLogFeatures
)

func (ConfigType) String

func (c ConfigType) String() string

Jump to

Keyboard shortcuts

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