migration

package
v0.0.0-...-89602ce Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

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

View Source
const CellularConfigKey = "cellular"
View Source
const CellularGatewayType = "cellular_gateway"
View Source
const CellularNetworkType = "cellular_network"

Redeclare config types and old config keys here for the same reason

View Source
const DnsConfigKey = "dns"
View Source
const DnsdGatewayType = "dnsd_gateway" // Technically this is unused
View Source
const DnsdNetworkType = "dnsd_network"
View Source
const GatewayConfigTable = "configs"
View Source
const MagmadConfigKey = "magmad"
View Source
const MagmadGatewayType = "magmad_gateway"
View Source
const MagmadNetworkType = "magmad_network"
View Source
const MeshConfigTable = "mesh_config"
View Source
const MeshType = "mesh"
View Source
const NetworkConfigTable = "networks"

Redeclare table names

View Source
const NewConfigTable = "configurations"
View Source
const WifiConfigKey = "wifi"
View Source
const WifiGatewayType = "wifi_gateway"
View Source
const WifiNetworkType = "wifi_network"

Variables

View Source
var File_magmad_configs_proto protoreflect.FileDescriptor

Functions

func Migrate

func Migrate(dbDriver string, dbSource string) error

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 MigrateGatewayConfigs(tx *sql.Tx) error

func MigrateMeshConfigs

func MigrateMeshConfigs(tx *sql.Tx) error

func MigrateNetworkConfigs

func MigrateNetworkConfigs(tx *sql.Tx) error

func Validate

func Validate(dbDriver string, dbSource string) error

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 ValidateNetwork(tx *sql.Tx, networkId string, oldNetworkConfig *Config) error

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) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetConfigsByKey

func (x *Config) GetConfigsByKey() map[string][]byte

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type TypeAndKey

type TypeAndKey struct {
	Type, Key string
}

Jump to

Keyboard shortcuts

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