Documentation ¶
Overview ¶
DB migration script for the config service refactor. This migration moves network and gateway configuration management from magmad to the config service, and mesh configuration management from mesh service to config service. Note this script does not pull in imports from any other magma code, instead opting for some code duplication (mainly of constants). This is intentional, as the migration should do the exact same thing regardless of how the rest of the code has changed.
DB validation script to run as a sanity check after a completed migration. This loads all existing configs from old magmad and mesh service tables and verifies that they all exist in the new config service tables.
Index ¶
- Constants
- Variables
- func Migrate(dbDriver string, dbSource string) error
- func MigrateGatewayConfigs(tx *sql.Tx) error
- func MigrateMeshConfigs(tx *sql.Tx) error
- func MigrateNetworkConfigs(tx *sql.Tx) error
- func Validate(dbDriver string, dbSource string) error
- func ValidateGatewayConfigs(oldGatewayConfigs map[string]*Config, newConfigs map[TypeAndKey][]byte) error
- func ValidateMeshConfigs(meshId string, oldMeshConfig []byte, newConfigs map[TypeAndKey][]byte) error
- func ValidateNetwork(tx *sql.Tx, networkId string, oldNetworkConfig *Config) error
- func ValidateNetworkConfigs(networkId string, oldNetworkConfig *Config, newConfigs map[TypeAndKey][]byte) error
- type Config
- type TypeAndKey
Constants ¶
const CellularConfigKey = "cellular"
const CellularGatewayType = "cellular_gateway"
const CellularNetworkType = "cellular_network"
Redeclare config types and old config keys here for the same reason
const DnsConfigKey = "dns"
const DnsdGatewayType = "dnsd_gateway" // Technically this is unused
const DnsdNetworkType = "dnsd_network"
const GatewayConfigTable = "configs"
const MagmadConfigKey = "magmad"
const MagmadGatewayType = "magmad_gateway"
const MagmadNetworkType = "magmad_network"
const MeshConfigTable = "mesh_config"
const MeshType = "mesh"
const NetworkConfigTable = "networks"
Redeclare table names
const NewConfigTable = "configurations"
const WifiConfigKey = "wifi"
const WifiGatewayType = "wifi_gateway"
const WifiNetworkType = "wifi_network"
Variables ¶
var File_magmad_configs_proto protoreflect.FileDescriptor
Functions ¶
func Migrate ¶
Entry point for the migration. Everything runs in 1 serializable postgres transaction so we don't end up in some weird half-migrated state.
func MigrateGatewayConfigs ¶
func MigrateMeshConfigs ¶
func MigrateNetworkConfigs ¶
func ValidateGatewayConfigs ¶
func ValidateGatewayConfigs(oldGatewayConfigs map[string]*Config, newConfigs map[TypeAndKey][]byte) error
func ValidateMeshConfigs ¶
func ValidateMeshConfigs(meshId string, oldMeshConfig []byte, newConfigs map[TypeAndKey][]byte) error
func ValidateNetwork ¶
func ValidateNetworkConfigs ¶
func ValidateNetworkConfigs(networkId string, oldNetworkConfig *Config, newConfigs map[TypeAndKey][]byte) error
Types ¶
type Config ¶
type Config struct { // Namespaced map of serialized configs ConfigsByKey map[string][]byte `` /* 187-byte string literal not displayed */ // contains filtered or unexported fields }
Container message type for namespaced network and gateway configs.
func (*Config) Descriptor
deprecated
func (*Config) GetConfigsByKey ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) ProtoReflect ¶
func (x *Config) ProtoReflect() protoreflect.Message
type TypeAndKey ¶
type TypeAndKey struct {
Type, Key string
}