storage

package
v0.0.0-...-5c76f2e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConversionGraph

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

ConversionGraph builds up a set of graphs of the required conversions between versions For each group (e.g. microsoft.storage or microsoft.batch) we have a separate subgraph of directed conversions

func (*ConversionGraph) FindHub

FindHub returns the type name of the hub resource, given the type name of one of the resources that is persisted using that hub type. This is done by following links in the conversion graph until we either reach the end or we find that a newer version of the type does not exist. Returns the hub type if found; an empty name and an error if not.

func (*ConversionGraph) FindHubAndDistance

func (graph *ConversionGraph) FindHubAndDistance(
	name astmodel.InternalTypeName,
	definitions astmodel.TypeDefinitionSet,
) (astmodel.InternalTypeName, int, error)

FindHubAndDistance returns the type name of the hub resource, given the type name of one of the resources that is persisted using that hub type. This is done by following links in the conversion graph until we either reach the end or we find that a newer version of the type does not exist. Returns the distance if a hub was found, an error if not.

func (*ConversionGraph) FindInPath

func (graph *ConversionGraph) FindInPath(
	start astmodel.InternalTypeName,
	predicate func(name astmodel.InternalTypeName) bool,
) (astmodel.InternalTypeName, bool)

FindInPath searches the path from the specified type name to the hub for a type name that matches the predicate, returning either the first matching type, and true, or an empty type name and false.

func (*ConversionGraph) FindNextProperty

func (graph *ConversionGraph) FindNextProperty(
	ref astmodel.PropertyReference,
	definitions astmodel.TypeDefinitionSet,
) (astmodel.PropertyReference, error)

FindNextProperty finds what a given property would be called on the next type in our conversion graph. Type renames are respected. When implemented, property renames need to be respected as well (this is why the method has been implemented here). declaringType is the type containing the property. property is the name of the property. definitions is a set of known definitions.

func (*ConversionGraph) FindNextType

FindNextType returns the type name of the next closest type on the path to the hub type. Returns the type name and no error if the next type is found; empty name and no error if not; empty name and an error if something goes wrong. If the name passed in is for the hub type for the given resource, no next type will be found. This is used to identify the next type needed for property assignment functions, and is a building block for identification of hub definitions.

func (*ConversionGraph) LookupTransition

func (graph *ConversionGraph) LookupTransition(name astmodel.InternalTypeName) astmodel.InternalTypeName

LookupTransition accepts a type name and looks up the transition to the next version in the graph Returns the next version and true if it's found, or an empty type name and false if not.

func (*ConversionGraph) SaveTo

func (graph *ConversionGraph) SaveTo(group string, kind string, filename string) error

func (*ConversionGraph) String

func (graph *ConversionGraph) String(group string, kind string) (string, error)

func (*ConversionGraph) TransitionCount

func (graph *ConversionGraph) TransitionCount() int

TransitionCount returns the number of transitions in the graph

func (*ConversionGraph) WriteTo

func (graph *ConversionGraph) WriteTo(group string, kind string, writer io.Writer) error

WriteTo gives a debug dump of the conversion graph for a particular type name

type ConversionGraphBuilder

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

ConversionGraphBuilder is used to construct a conversion graph with all the required conversions to/from/between the storage variants of the packages. It uses a separate GroupConversionGraphBuilder for each distinct group

func NewConversionGraphBuilder

func NewConversionGraphBuilder(
	configuration *config.ObjectModelConfiguration,
	versionPrefix string,
) *ConversionGraphBuilder

NewConversionGraphBuilder creates a new builder for all our required conversion graphs

func (*ConversionGraphBuilder) Add

Add includes the supplied TypeNames in the conversion graph

func (*ConversionGraphBuilder) AddAll

AddAll includes the TypeNames in the supplied set in conversion graph

func (*ConversionGraphBuilder) Build

Build connects all the provided API definitions together into a single conversion graph

type GroupConversionGraph

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

GroupConversionGraph represents the directed graph of conversions between versions for a single group

func (*GroupConversionGraph) LookupTransition

LookupTransition accepts a type name and looks up the transition to the next version in the graph Returns the next version if it's found, or an empty type name if not.

func (*GroupConversionGraph) TransitionCount

func (graph *GroupConversionGraph) TransitionCount() int

TransitionCount returns the number of transitions in the graph

func (*GroupConversionGraph) WriteTo

func (graph *GroupConversionGraph) WriteTo(kind string, writer io.Writer) error

WriteTo gives a debug dump of the conversion graph for a particular type name

type GroupConversionGraphBuilder

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

GroupConversionGraphBuilder is used to construct a conversion graph with all the required conversions to/from/between the storage variants of the packages. It uses a separate ResourceConversionGraphBuilder for each distinct resource/type

func NewGroupConversionGraphBuilder

func NewGroupConversionGraphBuilder(
	group string,
	configuration *config.ObjectModelConfiguration,
	versionPrefix string,
) *GroupConversionGraphBuilder

NewGroupConversionGraphBuilder creates a new builder for all our required conversion graphs

func (*GroupConversionGraphBuilder) Add

Add includes the supplied type names in the conversion graph

func (*GroupConversionGraphBuilder) AddAll

AddAll includes all the supplied types names in the conversion graph

func (*GroupConversionGraphBuilder) Build

Build connects all the provided API definitions together into a single conversion graph

type HubVersionMarker

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

HubVersionMarker is a utility for marking resource definitions as "hub" versions

func NewHubVersionMarker

func NewHubVersionMarker() *HubVersionMarker

NewHubVersionMarker returns a new hub version marker for flagging resource definitions

func (*HubVersionMarker) MarkAsStorageVersion

func (m *HubVersionMarker) MarkAsStorageVersion(def astmodel.TypeDefinition) (astmodel.TypeDefinition, error)

MarkAsStorageVersion marks the supplied type definition as the storage version

type PropertyConverter

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

PropertyConverter is used to convert the properties of object definitions as required for storage variants

func NewPropertyConverter

func NewPropertyConverter(definitions astmodel.TypeDefinitionSet) *PropertyConverter

NewPropertyConverter creates a new property converter for modifying object properties

func (*PropertyConverter) ConvertProperty

ConvertProperty applies our conversion rules to a specific property

type ResourceConversionGraph

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

ResourceConversionGraph represents the directed graph of conversions between versions for a single resource/type

func (*ResourceConversionGraph) LookupTransition

LookupTransition accepts a type name and looks up the transition to the next version in the graph Returns the next version, or an empty type name if not.

func (*ResourceConversionGraph) TransitionCount

func (graph *ResourceConversionGraph) TransitionCount() int

TransitionCount returns the number of transitions in the graph

func (*ResourceConversionGraph) WriteLines

func (graph *ResourceConversionGraph) WriteLines(writer io.Writer, lines ...string) error

func (*ResourceConversionGraph) WriteTo

func (graph *ResourceConversionGraph) WriteTo(writer io.Writer) error

WriteTo gives a debug dump of the conversion graph for a particular type name

func (*ResourceConversionGraph) WriteVersions

func (graph *ResourceConversionGraph) WriteVersions(writer io.Writer, versions set.Set[string]) error

type ResourceConversionGraphBuilder

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

ResourceConversionGraphBuilder is used to construct a group conversion graph with all the required conversions to/from/between storage variants of the packages

func NewResourceConversionGraphBuilder

func NewResourceConversionGraphBuilder(name string, versionPrefix string) *ResourceConversionGraphBuilder

NewResourceConversionGraphBuilder creates a new builder for a specific resource/type

func (*ResourceConversionGraphBuilder) Add

Add includes the supplied package reference(s) in the conversion graph for this group

func (*ResourceConversionGraphBuilder) Build

Build connects all the provided API definitions together into a single conversion graph

type TypeConverter

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

TypeConverter is used to create a storage variant of an API type

func NewTypeConverter

func NewTypeConverter(definitions astmodel.TypeDefinitionSet) *TypeConverter

NewTypeConverter creates a new converter for the creation of storage variants

func (*TypeConverter) ConvertDefinition

func (t *TypeConverter) ConvertDefinition(def astmodel.TypeDefinition) (astmodel.TypeDefinition, error)

ConvertDefinition applies our type conversion to a specific type definition

Jump to

Keyboard shortcuts

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