migration

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: BSD-3-Clause Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NetworksTable      = "cfg_networks"
	NetworkConfigTable = "cfg_network_configs"

	EntityTable      = "cfg_entities"
	EntityAssocTable = "cfg_assocs"
	EntityAclTable   = "cfg_acls"

	NwIDCol   = "id"
	NwNameCol = "name"
	NwDescCol = "description"
	NwVerCol  = "version"

	NwcIDCol   = "network_id"
	NwcTypeCol = "type"
	NwcValCol  = "value"

	EntPkCol   = "pk"
	EntNidCol  = "network_id"
	EntTypeCol = "type"
	EntKeyCol  = "\"key\""
	EntGidCol  = "graph_id"
	EntNameCol = "name"
	EntDescCol = "description"
	EntPidCol  = "physical_id"
	EntConfCol = "config"
	EntVerCol  = "version"

	AFrCol = "from_pk"
	AToCol = "to_pk"

	AclIdCol       = "id"
	AclEntCol      = "entity_pk"
	AclScopeCol    = "scope"
	AclPermCol     = "permission"
	AclTypeCol     = "type"
	AclIdFilterCol = "id_filter"
	AclVerCol      = "version"

	InternalNetworkID = "network_magma_internal"
)

duplicated constants from configurator

View Source
const (
	BlobNidCol  = "network_id"
	BlobTypeCol = "type"
	BlobKeyCol  = "\"key\""
	BlobValCol  = "value"
	BlobVerCol  = "version"
)

duplicated constants from blobstore

View Source
const (
	AgRecordTableName = "gatewayRecords"
	HwIdTableName     = "hwIds"
	NetworksTableName = "networks"
	GatewaysTableName = "gateways"
)

duplicated constants from magmad

View Source
const (
	ConfigTable   = "configurations"
	ConfigTypeCol = "type"
	ConfigKeyCol  = "\"key\""
	ConfigValCol  = "value"
)

duplicated constants from config

View Source
const (
	DatastoreKeyCol     = "\"key\""
	DatastoreValCol     = "value"
	DatastoreGenCol     = "generation_number"
	DatastoreDeletedCol = "deleted"
)
View Source
const MAGMA_ALT_NAME_TAG string = "magma_alt_name"

Go Struct tag to specify an alternative name for field name matching

View Source
const (
	NetworkFeaturesConfig = "orc8r_features"
)
View Source
const (
	StateServiceTable = "states"
)

Variables

This section is empty.

Functions

func DropNewTables

func DropNewTables(tx *sql.Tx) error

func FillIn

func FillIn(src interface{}, dest interface{}) int

FillIn assigns matching field values of src to dest A fields from src & dest are considered "matching" if they have identical names & Types FillIn will recursively inspect structures to find matching fields and return number of successfully set fields

func GetLegacyTableName

func GetLegacyTableName(networkID string, table string) string

func LoadPlugins

func LoadPlugins() error

func Migrate

func Migrate(dbDriver string, dbSource string) error

func MigrateGateways

func MigrateGateways(sc *squirrel.StmtCache, builder sqorc.StatementBuilder, networkIDs []string) (map[string]map[string]MigratedGatewayMeta, error)

func MigrateNetworks

func MigrateNetworks(sc *squirrel.StmtCache, builder sqorc.StatementBuilder) ([]string, error)

func RunCustomPluginMigrations

func RunCustomPluginMigrations(sc *squirrel.StmtCache, builder sqorc.StatementBuilder) error

func SetupTables

func SetupTables(tx *sql.Tx, builder sqorc.StatementBuilder) error

func Unmarshal

func Unmarshal(bt []byte, msg proto.Message) error

func UnmarshalJSONPBProtosFromDatastore

func UnmarshalJSONPBProtosFromDatastore(sc *squirrel.StmtCache, builder sqorc.StatementBuilder, networkID string, table string, msgInstance proto.Message) (map[string]proto.Message, error)

func UnmarshalProtoMessagesFromDatastore

func UnmarshalProtoMessagesFromDatastore(sc *squirrel.StmtCache, builder sqorc.StatementBuilder, networkID string, table string, msgInstance proto.Message) (map[string]proto.Message, error)

Types

type ConfigMigrator

type ConfigMigrator interface {
	GetType() string

	ToNewConfig(oldConfig []byte) ([]byte, error)
}

ConfigMigrator is responsible for deserializing a legacy config and reserializing it into a configurator config

type ConfiguratorMigrationPlugin

type ConfiguratorMigrationPlugin interface {
	GetConfigMigrators() []ConfigMigrator

	RunCustomMigrations(
		sc *squirrel.StmtCache,
		builder sqorc.StatementBuilder,
		migratedGatewayMetasByNetwork map[string]map[string]MigratedGatewayMeta,
	) error
}

ConfiguratorMigrationPlugin defines the surface area for modules to integrate into the configurator data migration.

type MigratedGatewayMeta

type MigratedGatewayMeta struct {
	Pk, GraphID string
}

returns gw ids and map between gw id and graph id

Jump to

Keyboard shortcuts

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