Documentation ¶
Index ¶
- Constants
- Variables
- func AddFallbackSourceFactory(factory FallbackFactory)
- func AddFallbackTargetFactory(factory FallbackFactory)
- func BuildSourceDoc(typ abstract.ProviderType, title string) string
- func BuildTargetDoc(typ abstract.ProviderType, title string) string
- func Doc(typ abstract.ProviderType, title string) string
- func SourceRules(provider abstract.ProviderType, rules map[schema.Type][]string)
- func SupportedTypes() []schema.Type
- func TargetRule(provider abstract.ProviderType, rules map[schema.Type]string)
- type Fallback
- type FallbackFactory
- type Rule
Constants ¶
const ( RestPlaceholder = "REST..." NotSupportedPlaceholder = "N/A" )
const LatestVersion int = 9
LatestVersion is the current (most recent) version of the typesystem. Increment this when adding a new fallback.
At any moment, fallbacks can only be "to" any version preceding the latest.
Zero value is reserved and MUST NOT be used.
When incrementing this value, DO ADD a link to the function(s) implementing this fallback to CHANGELOG.md in the current directory
const NewTransfersVersion int = 9
NewTransfersVersion is the version of the typesystem set for new transfers. It must be less or equal to the LatestVersion.
To upgrade typesystem version, the following process should be applied: 1. LatestVersion is increased & fallbacks are introduced in the first PR. NewTransfersVersion stays the same! 2. Controlplane and dataplane are deployed and dataplane now contains the fallbacks for a new version. 3. The second PR increases NewTransfersVersion. When a controlplane with this change is deployed, dataplanes already have the required fallbacks.
Variables ¶
var FallbackDoesNotApplyErr = xerrors.NewSentinel("this fallback does not apply")
var SourceFallbackFactories = make([]FallbackFactory, 0)
var TargetFallbackFactories = make([]FallbackFactory, 0)
Functions ¶
func AddFallbackSourceFactory ¶
func AddFallbackSourceFactory(factory FallbackFactory)
AddFallbackSourceFactory registers a fallbacks for a source of some type
This method is expected to be called in the `init()` function of a module which introduces a fallback when some additional behaviour is expected
func AddFallbackTargetFactory ¶
func AddFallbackTargetFactory(factory FallbackFactory)
AddFallbackTargetFactory registers a fallbacks for a target of some type
This method is expected to be called in the `init()` function of a module which introduces a fallback when some additional behaviour is expected
func BuildSourceDoc ¶
func BuildSourceDoc(typ abstract.ProviderType, title string) string
func BuildTargetDoc ¶
func BuildTargetDoc(typ abstract.ProviderType, title string) string
func SourceRules ¶
func SourceRules(provider abstract.ProviderType, rules map[schema.Type][]string)
func SupportedTypes ¶
func TargetRule ¶
func TargetRule(provider abstract.ProviderType, rules map[schema.Type]string)
Types ¶
type Fallback ¶
type Fallback struct { // To is the target typesystem version of this fallback To int // ProviderType limits the providers to which this fallback applies ProviderType abstract.ProviderType // Function defines the transformation. Input is an item of any kind. // // If a fallback does not apply, this method MUST return an error containing FallbackDoesNotApplyErr Function func(ci *abstract.ChangeItem) (*abstract.ChangeItem, error) }
Fallback defines a transformation from a newer version of typesystem to an older one.
type FallbackFactory ¶
type FallbackFactory func() Fallback
type Rule ¶
type Rule struct { // `Target` stores the mapping of `schema.Type`-s to provider-specific types for each `Target` provider. // example: // {schema.TypeString: "TEXT"} Target map[schema.Type]string // `Source` stores the conversion rules from the provider-specific type to the `schema.Type` for each `Source` provider. // example: // {"TINYTEXT": schema.TypeString} Source map[string]schema.Type }
func RuleFor ¶
func RuleFor(provider abstract.ProviderType) Rule