db

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0, BSD-3-Clause Imports: 18 Imported by: 14

Documentation

Overview

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

*

  • Copyright 2022 Comcast Cable Communications Management, LLC *
  • 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. *
  • SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	ProtocolVersion                      = 4
	DefaultKeyspace                      = "ApplicationsDiscoveryDataService"
	DefaultTestKeyspace                  = "ApplicationsDiscoveryDataServiceTest"
	DefaultDeviceKeyspace                = "odp"
	DefaultDeviceTestKeyspace            = "odp_test_keyspace"
	DefaultDevicePodTableName            = "pod_cpe_account"
	DisableInitialHostLookup             = false
	DefaultSleepTimeInMillisecond        = 10
	DefaultConnections                   = 2
	DefaultColumnValue                   = "data"
	NamedListPartColumnValue             = "NamedListData_part_"
	NamedListCountColumnValue            = "NamedListData_parts_count"
	DefaultXpcKeyspace                   = "xpc"
	DefaultXpcTestKeyspace               = "xpc_test_keyspace"
	DefaultXpcPrecookTableName           = "reference_document"
	DefaultXconfRecookingStatusTableName = "RecookingStatus"
)
View Source
const (
	ColumnValuePrefix     = "NamedListData"
	PartsCountColumnValue = ColumnValuePrefix + "_parts_count"
	CompressionChunkSize  = (64 * 1024) // In bytes
)
View Source
const (
	EcmMacColumnName    = "cpe_mac"
	PodSerialColumnName = "pod_id"
)
View Source
const (
	PenetrationMetricsTable            = "PenetrationMetrics"
	EstbMacColumnValue                 = "estb_mac"
	EcmMacColumnValue                  = "ecm_mac"
	SerialNumberColumnValue            = "serial_number"
	PartnerColumnValue                 = "partner"
	ModelColumnValue                   = "model"
	FwVersionColumnValue               = "fw_version"
	FwReportedVersionColumnValue       = "fw_reported_version"
	FwAdditionalVersionInfoColumnValue = "fw_additional_version_info"
	FwAppliedRuleColumnValue           = "fw_applied_rule"
	FwTsColumnValue                    = "fw_ts"
	ClientCertExpiryValue              = "client_cert_expiry"
	RecoveryCertExpiryValue            = "recovery_cert_expiry"
	RfcAppliedRulesColumnValue         = "rfc_applied_rules"
	RfcAccountMgmtColumnValue          = "rfc_account_mgmt"
	RfcFeaturesColumnValue             = "rfc_features"
	RfcPartnerColumnValue              = "rfc_partner"
	TitanPartnerColumnValue            = "titan_partner"
	RfcModelColumnValue                = "rfc_model"
	RfcFwReportedVersionColumnValue    = "rfc_fw_reported_version"
	RfcAccountHashColumnValue          = "rfc_account_hash"
	RfcAccountIdColumnValue            = "rfc_account_id"
	TitanAccountIdColumnValue          = "titan_account_id"
	RfcEnvColumnValue                  = "rfc_env"
	RfcApplicationTypeColumnValue      = "rfc_application_type"
	RfcExperienceColumnValue           = "rfc_experience"
	RfcTimeZoneColumnValue             = "rfc_time_zone"
	RfcConfigsetHashColumnValue        = "rfc_configsethash"
	RfcQueryParamsColumnValue          = "rfc_query_params"
	RfcTagsColumnValue                 = "rfc_tags"
	RfcEstbIpColumnValue               = "rfc_estb_ip"
	RfcTsColumnValue                   = "rfc_ts"
	RfcPostProcColumnValue             = "rfc_post_proc"
)
View Source
const (
	XcrpModuleNameColumnName     = "module"
	XcrpPartionIdColumnName      = "partition_id"
	XcrpStateColumnName          = "state"
	XcrpUpdatedTimeColumnName    = "updated_time"
	XcrpRecookingStatusTableName = "RecookingStatus"
	XcrpAppNameColumnName        = "app_name"
)
View Source
const (
	PrecookInitialized = iota
	PrecookPending
	PrecookComplete
)
View Source
const (
	// LogUpload
	TABLE_DCM_RULE            = "DcmRule"
	TABLE_UPLOAD_REPOSITORY   = "UploadRepository"
	TABLE_LOG_UPLOAD_SETTINGS = "LogUploadSettings2"
	TABLE_LOG_FILE            = "LogFile"
	TABLE_LOG_FILE_LIST       = "LogFileList"
	TABLE_INDEXED_LOG_FILES   = "IndexedLogFiles"
	TABLE_LOG_FILES_GROUPS    = "LogFilesGroups"
	TABLE_DEVICE_SETTINGS     = "DeviceSettings2"
	TABLE_VOD_SETTINGS        = "VodSettings2"

	// Setting
	TABLE_SETTING_PROFILES = "SettingProfiles"
	TABLE_SETTING_RULES    = "SettingRules"

	// Telemetry
	TABLE_TELEMETRY              = "Telemetry"
	TABLE_TELEMETRY_RULES        = "TelemetryRules"
	TABLE_TELEMETRY_TWO_RULES    = "TelemetryTwoRules"
	TABLE_TELEMETRY_TWO_PROFILES = "TelemetryTwoProfiles"
	TABLE_PERMANENT_TELEMETRY    = "PermanentTelemetry"

	// Firmware
	TABLE_FIRMWARE_RULE          = "FirmwareRule4"
	TABLE_FIRMWARE_RULE_TEMPLATE = "FirmwareRuleTemplate"
	TABLE_FIRMWARE_CONFIG        = "FirmwareConfig"
	TABLE_SINGLETON_FILTER_VALUE = "SingletonFilterValue"

	// RFC
	TABLE_FEATURE_CONTROL_RULE = "FeatureControlRule2"
	TABLE_XCONF_FEATURE        = "XconfFeature"

	// Change
	TABLE_XCONF_CHANGE                        = "XconfChange"
	TABLE_XCONF_APPROVED_CHANGE               = "XconfApprovedChange"
	TABLE_XCONF_TELEMETRY_TWO_CHANGE          = "XconfTelemetryTwoChange"
	TABLE_XCONF_APPROVED_TELEMETRY_TWO_CHANGE = "XconfApprovedTelemetryTwoChange"

	// Common
	TABLE_ENVIRONMENT        = "Environment"
	TABLE_MODEL              = "Model"
	TABLE_IP_ADDRESS_GROUP   = "IpAddressGroupExtended"
	TABLE_NS_LIST            = "XconfNamedList"
	TABLE_GENERIC_NS_LIST    = "GenericXconfNamedList"
	TABLE_LOGS               = "Logs2"
	TABLE_XCONF_CHANGED_KEYS = "XconfChangedKeys4"
	TABLE_APP_SETTINGS       = "AppSettings"
	TABLE_TAG                = "Tag"
)
View Source
const (
	DefaultKey2FieldName     = "column1"
	ChangedKeysKey2FieldName = "columnName"
)

Two possible values for Key2FieldName

View Source
const (
	RfcPrecookHashColumnName    = "ref_id"
	RfcPrecookPayloadColumnName = "payload"
	VersionColumnName           = "version"
)
View Source
const TwowKeysDelimiter = "::"

TwoKeys Xconf key values

Variables

Functions

func ConfigInjection

func ConfigInjection(conf *configuration.Config)

ConfigInjection - dependency injection

func GetColumnsStr

func GetColumnsStr(columns []string) string

func GetGrpCacheLoadFunc

func GetGrpCacheLoadFunc() func(k cache.Key) (cache.Value, error)

func GetSetColumnsStr

func GetSetColumnsStr(columns []string) string

func GetValuesStr

func GetValuesStr(length int) string

func IsCassandraClient

func IsCassandraClient() bool

func NewChangedDataInf

func NewChangedDataInf() interface{}

func RegisterTableConfig

func RegisterTableConfig(tableInfo *TableInfo)

* RegisterTableConfig registers information related to the table name, * i.e. constructor function, compression policy, and TTL for data.

func RegisterTableConfigSimple

func RegisterTableConfigSimple(tableName string, fn func() interface{})

* RegisterTableConfigSimple registers constructor function for a table.

func SetDatabaseClient

func SetDatabaseClient(c DatabaseClient)

func SetGrpCacheLoadFunc

func SetGrpCacheLoadFunc(f func(k cache.Key) (cache.Value, error))

Types

type CacheInfo

type CacheInfo struct {
	Stats *CacheStats
	// contains filtered or unexported fields
}

type CacheManager

type CacheManager struct {
	Settings CacheSettings
	// contains filtered or unexported fields
}

CacheManager a cache manager

func GetCacheManager

func GetCacheManager() CacheManager

GetCacheManager Initializes a CacheManager

func (CacheManager) ApplicationCacheDelete

func (cm CacheManager) ApplicationCacheDelete(tableName string, key string)

Delete an entry from the application cache

func (CacheManager) ApplicationCacheDeleteAll

func (cm CacheManager) ApplicationCacheDeleteAll(tableName string)

Delete all entries for the given table

func (CacheManager) ApplicationCacheGet

func (cm CacheManager) ApplicationCacheGet(tableName string, key string) interface{}

ApplicationCacheGet value for the specified table and key

func (CacheManager) ApplicationCacheInvalidateAll

func (cm CacheManager) ApplicationCacheInvalidateAll()

Delete all entries

func (CacheManager) ApplicationCacheSet

func (cm CacheManager) ApplicationCacheSet(tableName string, key string, value interface{})

Set value for the specified table and key

func (CacheManager) DeleteGroupServiceFeatureTags

func (cm CacheManager) DeleteGroupServiceFeatureTags(cacheKey string) error

func (CacheManager) ForceSyncChanges

func (cm CacheManager) ForceSyncChanges()

func (CacheManager) GetCacheStats

func (cm CacheManager) GetCacheStats(tableName string) (*CacheStats, error)

func (CacheManager) GetChangedKeysTimeWindowSize

func (cm CacheManager) GetChangedKeysTimeWindowSize() int32

func (CacheManager) GetGroupServiceFeatureTags

func (cm CacheManager) GetGroupServiceFeatureTags(cacheKey string) map[string]string

func (CacheManager) GetStatistics

func (cm CacheManager) GetStatistics() *Statistics

GetStatistics returns cache statistics

func (CacheManager) Refresh

func (cm CacheManager) Refresh(tableName string) error

Refresh Refresh cache for the specified table

func (CacheManager) RefreshAll

func (cm CacheManager) RefreshAll() []string

RefreshAll Refresh all caches and return list of table names which were not refreshed

func (CacheManager) SetGroupServiceFeatureTags

func (cm CacheManager) SetGroupServiceFeatureTags(cacheKey string, tags map[string]string) error

func (CacheManager) SyncChanges

func (cm CacheManager) SyncChanges(startTime time.Time, endTime time.Time, apply bool) (changedList []interface{}, err error)

SyncChanges Updates changes for given time-window defined by start (lower bound, inclusive) and end (upper bound, exclusive)

func (CacheManager) WriteCacheLog

func (cm CacheManager) WriteCacheLog(tableName string, changedKey string, operation OperationType)

Write changed data to XconfChangedKeys4 table asynchronously

type CacheRefreshTask

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

CacheRefreshTask background task to refresh cache

func (*CacheRefreshTask) Run

func (t *CacheRefreshTask) Run()

func (*CacheRefreshTask) Stop

func (t *CacheRefreshTask) Stop()

type CacheSettings

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

CacheSettings settings for the cache

type CacheStats

type CacheStats struct {
	DaoRefreshTime time.Time     `json:"daoRefreshTime"`
	CacheSize      int           `json:"cacheSize"`
	RequestCount   uint64        `json:"requestCount"`
	NonAbsentCount int           `json:"nonAbsentCount"`
	EvictionCount  uint64        `json:"evictionCount"`
	HitRate        float64       `json:"hitRate"`
	MissRate       float64       `json:"missRate"`
	TotalLoadTime  time.Duration `json:"totalLoadTime"`
}

CacheStats statistics for the cache.LoadingCache

type CachedListingDao

type CachedListingDao interface {
	GetOne(tableName string, rowKey string, key2 interface{}) (interface{}, error)
	SetOne(tableName string, rowKey string, key2 interface{}, entity interface{}) error
	DeleteOne(tableName string, rowKey string, key2 interface{}) error
	DeleteAll(tableName string, rowKey string) error
	GetAll(tableName string, rowKey string) ([]interface{}, error)
	GetAllAsMap(tableName string, rowKey string, key2List []interface{}) (map[interface{}]interface{}, error)
	GetKeys(tableName string) ([]TwoKeys, error)
	GetKey2AsList(tableName string, rowKey string) ([]interface{}, error)
}

CachedListingDao interface for ListingDao

func GetCachedListingDao

func GetCachedListingDao() CachedListingDao

GetCachedListingDao returns CachedListingDao

type CachedSimpleDao

type CachedSimpleDao interface {
	GetOne(tableName string, rowKey string) (interface{}, error)
	GetOneFromCacheOnly(tableName string, rowKey string) (interface{}, error)
	SetOne(tableName string, rowKey string, entity interface{}) error
	DeleteOne(tableName string, rowKey string) error
	GetAllByKeys(tableName string, rowKeys []string) ([]interface{}, error)
	GetAllAsList(tableName string, maxResults int) ([]interface{}, error)
	GetAllAsMap(tableName string) (map[interface{}]interface{}, error)
	GetKeys(tableName string) ([]interface{}, error)
	RefreshAll(tableName string) error
	RefreshOne(tableName string, rowKey string) error
}

CachedSimpleDao interface for SimpleDao and CompressingDataDao

func GetCachedSimpleDao

func GetCachedSimpleDao() CachedSimpleDao

GetCachedSimpleDao returns CachedSimpleDao

type CassandraClient

type CassandraClient struct {
	*gocql.Session
	*gocql.ClusterConfig
	SleepTime          int32
	ConcurrentQueries  chan bool
	LocalDc            string
	DeviceKeyspace     string
	DevicePodTableName string
	TestOnly           bool
	Connection_type    string
	// contains filtered or unexported fields
}

func (*CassandraClient) CheckFinalRecookingStatus

func (c *CassandraClient) CheckFinalRecookingStatus(moduleName string) (bool, time.Time, error)

func (*CassandraClient) Close

func (c *CassandraClient) Close() error

func (*CassandraClient) DeleteAllXconfData

func (c *CassandraClient) DeleteAllXconfData(tableName string) error

DeleteAllXconfData Delete all XconfData

func (*CassandraClient) DeleteXconfData

func (c *CassandraClient) DeleteXconfData(tableName string, rowKey string) error

DeleteXconfData Delete XconfData for the specified key

func (*CassandraClient) DeleteXconfDataTwoKeys

func (c *CassandraClient) DeleteXconfDataTwoKeys(tableName string, rowKey string, key2FieldName string, key2 interface{}) error

DeleteXconfDataTwoKeys Delete XconfData for the specified two keys

func (*CassandraClient) GetAllXconfCompressedDataAsMap

func (c *CassandraClient) GetAllXconfCompressedDataAsMap(tableName string) map[string][]byte

GetAllXconfCompressedDataAsMap Get all rows as a map of key to value, where value is compressed JSON data

func (*CassandraClient) GetAllXconfData

func (c *CassandraClient) GetAllXconfData(tableName string, rowKey string) [][]byte

GetAllXconfData Get multiple rows as a list of values, where value is JSON data

func (*CassandraClient) GetAllXconfDataAsList

func (c *CassandraClient) GetAllXconfDataAsList(tableName string, maxResults int) [][]byte

GetAllXconfDataAsList Get all rows as a list of values, where value is JSON data

func (*CassandraClient) GetAllXconfDataAsMap

func (c *CassandraClient) GetAllXconfDataAsMap(tableName string, maxResults int) map[string][]byte

GetAllXconfDataAsMap Get all rows as a map of key to value, where value is JSON data

func (*CassandraClient) GetAllXconfDataByKeys

func (c *CassandraClient) GetAllXconfDataByKeys(tableName string, rowKeys []string) [][]byte

GetAllXconfDataByKeys Get all rows as a list of values for the specified keys, where value is JSON data

func (*CassandraClient) GetAllXconfDataTwoKeysAsMap

func (c *CassandraClient) GetAllXconfDataTwoKeysAsMap(tableName string, rowKey string, key2FieldName string, key2List []interface{}) map[interface{}][]byte

GetAllXconfDataTwoKeysAsMap Get multiple rows for the specified key and key2 list as map of values, where value is JSON data

func (*CassandraClient) GetAllXconfDataTwoKeysRange

func (c *CassandraClient) GetAllXconfDataTwoKeysRange(tableName string, rowKey interface{}, key2FieldName string, rangeInfo *RangeInfo) [][]byte

GetAllXconfDataTwoKeysRange Get multiple rows for the specified key and key2 range as list of values, where value is JSON data

func (*CassandraClient) GetAllXconfKey2s

func (c *CassandraClient) GetAllXconfKey2s(tableName string, rowKey string, key2FieldName string) []interface{}

GetAllXconfKey2s Get a list of Xconf key2 for the specified rowKey

func (*CassandraClient) GetAllXconfKeys

func (c *CassandraClient) GetAllXconfKeys(tableName string) []string

GetAllXconfKeys Get all keys

func (*CassandraClient) GetAllXconfTwoKeys

func (c *CassandraClient) GetAllXconfTwoKeys(tableName string, key2FieldName string) []TwoKeys

GetAllXconfTwoKeys Get all TwoKeys

func (*CassandraClient) GetDeviceKeyspace

func (c *CassandraClient) GetDeviceKeyspace() string

func (*CassandraClient) GetDevicePodTableName

func (c *CassandraClient) GetDevicePodTableName() string

func (*CassandraClient) GetEcmMacFromPodTable

func (c *CassandraClient) GetEcmMacFromPodTable(serialNum string) (string, error)

GetEcmMacFromPodTable Get ecmMacAdress from table cpe_mac using pod serialNum

func (*CassandraClient) GetEstbIp

func (c *CassandraClient) GetEstbIp(estbMac string) (string, error)

func (*CassandraClient) GetFwPenetrationMetrics

func (c *CassandraClient) GetFwPenetrationMetrics(estbMac string) (*FwPenetrationMetrics, error)

func (*CassandraClient) GetLocalDc

func (c *CassandraClient) GetLocalDc() string

func (*CassandraClient) GetPenetrationMetrics

func (c *CassandraClient) GetPenetrationMetrics(estbMac string) (map[string]interface{}, error)

func (*CassandraClient) GetPrecookDataFromXPC

func (c *CassandraClient) GetPrecookDataFromXPC(RfcPrecookHash string) ([]byte, string, error)

GetPrecookDataFromXPC Get Precook data from XPC

func (*CassandraClient) GetRecookingStatus

func (c *CassandraClient) GetRecookingStatus(moduleName string, partitionId string) (int, time.Time, error)

func (*CassandraClient) GetRecookingStatusDetails

func (c *CassandraClient) GetRecookingStatusDetails() ([]RecookingStatus, error)

func (*CassandraClient) GetRfcPenetrationMetrics

func (c *CassandraClient) GetRfcPenetrationMetrics(estbMac string) (*RfcPenetrationMetrics, error)

func (*CassandraClient) GetXconfCompressedData

func (c *CassandraClient) GetXconfCompressedData(tableName string, rowKey string) ([]byte, error)

GetXconfCompressedData Get one row where return value is compressed JSON data

func (*CassandraClient) GetXconfCompressedDataRaw

func (c *CassandraClient) GetXconfCompressedDataRaw(tableName string) map[string]map[string][]byte

GetXconfCompressedDataRaw Get all rows as a map of key to another map, where key specifies part number and value is compressed JSON data chunk.

Sample data for one record in GenericXconfNamedList table:

key | column1 | value -------------------+---------------------------+----------------------------- Test_Mac_List | NamedListData_part_0 | 0x7df05a7b226964223a2241... Test_Mac_List | NamedListData_part_1 | 0x60f05f7b226964223a2231... Test_Mac_List | NamedListData_parts_count | 0x00000002

func (*CassandraClient) GetXconfData

func (c *CassandraClient) GetXconfData(tableName string, rowKey string) ([]byte, error)

GetXconfData Get one row where return value is JSON data

func (*CassandraClient) GetXconfDataTwoKeys

func (c *CassandraClient) GetXconfDataTwoKeys(tableName string, rowKey string, key2FieldName string, key2 interface{}) ([]byte, error)

GetXconfDataTwoKeys Get one row where return value is JSON data

func (*CassandraClient) IsDbNotFound

func (c *CassandraClient) IsDbNotFound(err error) bool

func (*CassandraClient) IsTestOnly

func (c *CassandraClient) IsTestOnly() bool

func (*CassandraClient) SetFwPenetrationMetrics

func (c *CassandraClient) SetFwPenetrationMetrics(pMetrics *FwPenetrationMetrics) error

func (*CassandraClient) SetPenetrationMetrics

func (c *CassandraClient) SetPenetrationMetrics(pMetrics *PenetrationMetrics) error

func (*CassandraClient) SetPrecookDataInXPC

func (c *CassandraClient) SetPrecookDataInXPC(RfcPrecookHash string, RfcPrecookPayload []byte) error

setPrecookDataInXPC Set Precook data in XPC

func (*CassandraClient) SetRecookingStatus

func (c *CassandraClient) SetRecookingStatus(moduleName string, partitionId string, state int) error

func (*CassandraClient) SetRfcPenetrationMetrics

func (c *CassandraClient) SetRfcPenetrationMetrics(pMetrics *RfcPenetrationMetrics) error

func (*CassandraClient) SetUp

func (c *CassandraClient) SetUp() error

func (*CassandraClient) SetXconfCompressedData

func (c *CassandraClient) SetXconfCompressedData(tableName string, rowKey string, values [][]byte, ttl int) error

SetXconfCompressedData Create XconfData for the specified key and values, where values is compressed JSON data

func (*CassandraClient) SetXconfData

func (c *CassandraClient) SetXconfData(tableName string, rowKey string, value []byte, ttl int) error

SetXconfData Create XconfData for the specified key and value, where value is JSON data

func (*CassandraClient) SetXconfDataTwoKeys

func (c *CassandraClient) SetXconfDataTwoKeys(tableName string, rowKey interface{}, key2FieldName string, key2 interface{}, value []byte, ttl int) error

SetXconfDataTwoKeys Create XconfData for the specified two keys and value, where value is JSON data

func (*CassandraClient) Sleep

func (c *CassandraClient) Sleep()

func (*CassandraClient) TearDown

func (c *CassandraClient) TearDown() error

func (*CassandraClient) UpdateFwPenetrationMetrics

func (c *CassandraClient) UpdateFwPenetrationMetrics(kvmap map[string]string) error

func (*CassandraClient) XconfRecookingStatusTableName

func (c *CassandraClient) XconfRecookingStatusTableName() string

func (*CassandraClient) XpcKeyspace

func (c *CassandraClient) XpcKeyspace() string

func (*CassandraClient) XpcPrecookTableName

func (c *CassandraClient) XpcPrecookTableName() string

type CassandraConnector

type CassandraConnector interface {
	NewCassandraClient(conf *configuration.Config, testOnly bool) (*CassandraClient, error)
}

Interface used for connecting to Cassandra in a cloud environment

type ChangedData

type ChangedData struct {
	ColumnName     gocql.UUID    `json:"columnName"`
	CfName         string        `json:"cfName"`
	ChangedKey     string        `json:"changedKey"`
	Operation      OperationType `json:"operation"`
	DaoId          int32         `json:"DAOid"`
	ValidCacheSize int32         `json:"validCacheSize"`
	UserName       string        `json:"userName"`
}

ChangedData XconfChangedKeys4 table

type CompressingDataDao

type CompressingDataDao interface {
	GetOne(tableName string, rowKey string) (interface{}, error)
	SetOne(tableName string, rowKey string, value []byte) error
	DeleteOne(tableName string, rowKey string) error
	GetAllByKeys(tableName string, rowKeys []string) ([]interface{}, error)
	GetAllAsList(tableName string, continueOnError bool) ([]interface{}, error)
	GetAllAsMap(tableName string, continueOnError bool) (map[string]interface{}, error)
	GetKeys(tableName string) []string
}

CompressingDataDao interface

func GetCompressingDataDao

func GetCompressingDataDao() CompressingDataDao

GetCompressingDataDao return an implementation of CompressingDataDao

type DatabaseClient

type DatabaseClient interface {
	SetUp() error
	TearDown() error
	Close() error
	Sleep()

	// Xconf
	SetXconfData(tableName string, rowKey string, value []byte, ttl int) error
	GetXconfData(tableName string, rowKey string) ([]byte, error)
	GetAllXconfDataByKeys(tableName string, rowKeys []string) [][]byte
	GetAllXconfKeys(tableName string) []string
	GetAllXconfDataAsList(tableName string, maxResults int) [][]byte
	GetAllXconfDataAsMap(tableName string, maxResults int) map[string][]byte
	DeleteXconfData(tableName string, rowKey string) error
	DeleteAllXconfData(tableName string) error

	// Xconf TwoKeys
	GetAllXconfData(tableName string, rowKey string) [][]byte
	GetAllXconfDataTwoKeysRange(tableName string, rowKey interface{}, key2FieldName string, rangeInfo *RangeInfo) [][]byte
	GetAllXconfDataTwoKeysAsMap(tableName string, rowKey string, key2FieldName string, key2List []interface{}) map[interface{}][]byte
	SetXconfDataTwoKeys(tableName string, rowKey interface{}, key2FieldName string, key2 interface{}, value []byte, ttl int) error
	GetXconfDataTwoKeys(tableName string, rowKey string, key2FieldName string, key2 interface{}) ([]byte, error)
	DeleteXconfDataTwoKeys(tableName string, rowKey string, key2FieldName string, key2 interface{}) error
	GetAllXconfTwoKeys(tableName string, key2FieldName string) []TwoKeys
	GetAllXconfKey2s(tableName string, rowKey string, key2FieldName string) []interface{}
	// Xconf compressed data
	SetXconfCompressedData(tableName string, rowKey string, values [][]byte, ttl int) error
	GetXconfCompressedData(tableName string, rowKey string) ([]byte, error)
	GetAllXconfCompressedDataAsMap(tableName string) map[string][]byte

	// Pod table lookup estbMac from pod serialNum
	GetEcmMacFromPodTable(string) (string, error)

	//Penetration Metrics
	GetPenetrationMetrics(macAddress string) (map[string]interface{}, error)
	SetPenetrationMetrics(penetrationmetrics *PenetrationMetrics) error

	// not found
	IsDbNotFound(error) bool

	//Penetration Metrics
	SetFwPenetrationMetrics(*FwPenetrationMetrics) error
	GetFwPenetrationMetrics(string) (*FwPenetrationMetrics, error)
	SetRfcPenetrationMetrics(*RfcPenetrationMetrics) error
	GetRfcPenetrationMetrics(string) (*RfcPenetrationMetrics, error)
	UpdateFwPenetrationMetrics(map[string]string) error
	GetEstbIp(string) (string, error)

	SetRecookingStatus(module string, partitionId string, state int) error
	GetRecookingStatus(module string, partitionId string) (int, time.Time, error)
	CheckFinalRecookingStatus(module string) (bool, time.Time, error)

	////XPC precook reference data
	SetPrecookDataInXPC(RfcPrecookHash string, RfcPrecookPayload []byte) error
	GetPrecookDataFromXPC(RfcPrecookHash string) ([]byte, string, error)
}

func GetDatabaseClient

func GetDatabaseClient() DatabaseClient

type DefaultCassandraConnection

type DefaultCassandraConnection struct {
	Connection_type string
}

example Default connector

func (*DefaultCassandraConnection) NewCassandraClient

func (ca *DefaultCassandraConnection) NewCassandraClient(conf *configuration.Config, testOnly bool) (*CassandraClient, error)

type FwPenetrationMetrics

type FwPenetrationMetrics struct {
	EstbMac                 string
	Partner                 string
	Model                   string
	FwVersion               string
	FwReportedVersion       string
	FwAdditionalVersionInfo string
	FwAppliedRule           string
	FwTs                    int64
	ClientCertExpiry        string
	RecoveryCertExpiry      string
}

PenetrationMetrics struct

type GroupServiceCacheDao

type GroupServiceCacheDao interface {
	GetGroupServiceFeatureTags(cacheKey string) map[string]string
	SetGroupServiceFeatureTags(cacheKey string, tags map[string]string) error
	DeleteGroupServiceFeatureTags(cacheKey string) error
}

XdasCacheDao interface for XDAS cache operations

func GetGroupServiceCacheDao

func GetGroupServiceCacheDao() GroupServiceCacheDao

GetGroupServiceCacheDao returns GroupServiceCacheDao

type GroupServiceCacheDaoImpl

type GroupServiceCacheDaoImpl struct{}

func (GroupServiceCacheDaoImpl) DeleteGroupServiceFeatureTags

func (dao GroupServiceCacheDaoImpl) DeleteGroupServiceFeatureTags(cacheKey string) error

DeleteGroupServiceFeatureTags removes GroupService feature tags from the cache

func (GroupServiceCacheDaoImpl) GetGroupServiceFeatureTags

func (dao GroupServiceCacheDaoImpl) GetGroupServiceFeatureTags(cacheKey string) map[string]string

GetGroupServiceFeatureTags retrieves GroupService feature tags from the cache

func (GroupServiceCacheDaoImpl) SetGroupServiceFeatureTags

func (dao GroupServiceCacheDaoImpl) SetGroupServiceFeatureTags(cacheKey string, tags map[string]string) error

SetGroupServiceFeatureTags stores GroupService feature tags in the cache

type ListingDao

type ListingDao interface {
	GetOne(tableName string, rowKey string, key2 interface{}) (interface{}, error)
	SetOne(tableName string, rowKey interface{}, key2 interface{}, value []byte) error
	DeleteOne(tableName string, rowKey string, key2 interface{}) error
	DeleteAll(tableName string, rowKey string) error
	GetAll(tableName string, rowKey string) ([]interface{}, error)
	GetAllAsList(tableName string) ([]interface{}, error)
	GetAllAsMap(tableName string, rowKey string, key2List []interface{}) (map[interface{}]interface{}, error)
	GetRange(tableName string, rowKey interface{}, rangeInfo *RangeInfo) ([]interface{}, error)
	GetKeys(tableName string) ([]TwoKeys, error)
	GetKey2AsList(tableName string, rowKey string) ([]interface{}, error)
}

ListingDao interface

func GetListingDao

func GetListingDao() ListingDao

GetListingDao return an implementation of ListingDao

type OperationType

type OperationType string

OperationType enum

const (
	CREATE_OPERATION   OperationType = "CREATE"
	UPDATE_OPERATION   OperationType = "UPDATE"
	DELETE_OPERATION   OperationType = "DELETE"
	TRUNCATE_OPERATION OperationType = "TRUNCATE_CF"
)

type PenetrationMetrics

type PenetrationMetrics struct {
	EstbMac                 string
	Partner                 string
	Model                   string
	FwVersion               string
	FwReportedVersion       string
	FwAdditionalVersionInfo string
	FwAppliedRule           string
	FwTs                    time.Time
	RfcAppliedRules         string
	RfcFeatures             string
	RfcTs                   time.Time
}

type RangeInfo

type RangeInfo struct {
	StartValue interface{}
	EndValue   interface{}
}

RangeInfo Xconf key2 filtering

func (*RangeInfo) IsNilEndValue

func (ri *RangeInfo) IsNilEndValue() bool

func (*RangeInfo) IsNilStartValue

func (ri *RangeInfo) IsNilStartValue() bool

type RecookingStatus

type RecookingStatus struct {
	AppName     string    `json:"appName"`
	PartitionId string    `json:"partitionId"`
	State       int       `json:"state"`
	UpdatedTime time.Time `json:"updatedTime"`
}

type RfcPenetrationMetrics

type RfcPenetrationMetrics struct {
	EstbMac              string
	EcmMac               string
	SerialNum            string
	Partner              string
	Model                string
	RfcPartner           string
	TitanPartner         string
	RfcModel             string
	RfcFwReportedVersion string
	RfcAppliedRules      string
	RfcAccountMgmt       string
	RfcFeatures          string
	RfcTs                int64
	RfcAccountHash       string
	RfcAccountId         string
	TitanAccountId       string
	RfcEnv               string
	RfcApplicationType   string
	RfcExperience        string
	RfcTimeZone          string
	RfcConfigsetHash     string
	RfcQueryParams       string
	RfcTags              string
	RfcEstbIp            string
	RfcPostProc          string
	ClientCertExpiry     string
	RecoveryCertExpiry   string
}

type SimpleDao

type SimpleDao interface {
	GetOne(tableName string, rowKey string) (interface{}, error)
	SetOne(tableName string, rowKey string, value []byte) error
	DeleteOne(tableName string, rowKey string) error
	GetAllByKeys(tableName string, rowKeys []string) ([]interface{}, error)
	GetAllAsList(tableName string, maxResults int) ([]interface{}, error)
	GetAllAsMap(tableName string, maxResults int) (map[string]interface{}, error)
	GetKeys(tableName string) []string
	GetAllAsMapRaw(tableName string, maxResults int) (map[string]json.RawMessage, error)
}

SimpleDao interface

func GetSimpleDao

func GetSimpleDao() SimpleDao

GetSimpleDao return an implementation of SimpleDao

type Statistics

type Statistics struct {
	CacheMap map[string]CacheStats `json:"Statistics"`
}

Statistics cache statistics

type TableInfo

type TableInfo struct {
	TableName       string
	ConstructorFunc func() interface{} // model/struct constructor function
	Compress        bool               // data is compressed
	Split           bool               // data is split into multiple chunks
	CacheData       bool               // specifies whether to cache the data
	TTL             int                // TTL for the data
	Key2FieldName   string             // column name for listing table, e.g. Logs2, XconfChangedKeys4
	DaoId           int32              // Xconf DAO ID
}

func GetAllTableInfo

func GetAllTableInfo() []TableInfo

func GetTableInfo

func GetTableInfo(tableName string) (*TableInfo, error)

func (*TableInfo) IsCompressAndSplit

func (ti *TableInfo) IsCompressAndSplit() bool

IsCompressAndSplit checks if data is compressed and split, i.e. CompressingDataDao

func (*TableInfo) IsCompressOnly

func (ti *TableInfo) IsCompressOnly() bool

IsCompressOnly checks if data is compressed, i.e. ListingDao

type TwoKeys

type TwoKeys struct {
	Key  string
	Key2 interface{}
}

func NewTwoKeys

func NewTwoKeys(Key string, Key2 interface{}) *TwoKeys

func NewTwoKeysFromString

func NewTwoKeysFromString(tk string) (*TwoKeys, error)

func (*TwoKeys) String

func (tk *TwoKeys) String() string

Jump to

Keyboard shortcuts

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