convert

package
v3.0.0-...-a5432f4 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapperRegistration

func MapperRegistration(m codegenrpc.MapperServer) func(*grpc.Server)

func NewMapperServer

func NewMapperServer(mapper Mapper) codegenrpc.MapperServer

Types

type Mapper

type Mapper interface {
	// Returns plugin specific mapping data for the given provider name. The "codeinfraProvider" is used as a
	// hint for which codeinfra plugin will provider this mapping. Returns an empty result if no mapping
	// information was available.
	GetMapping(ctx context.Context, provider string, codeinfraProvider string) ([]byte, error)
}

An interface to map provider names (N.B. These aren't Codeinfra provider names, but the names of "providers" in the source language being converted from) to plugin specific mapping data.

func NewMapperClient

func NewMapperClient(target string) (Mapper, error)

func NewPluginMapper

func NewPluginMapper(ws Workspace,
	providerFactory ProviderFactory,
	key string, mappings []string,
	installProvider func(tokens.Package) *semver.Version,
) (Mapper, error)

type ProviderFactory

type ProviderFactory func(tokens.Package, *semver.Version) (plugin.Provider, error)

ProviderFactory creates a provider for a given package and version.

func ProviderFactoryFromHost

func ProviderFactoryFromHost(host plugin.Host) ProviderFactory

ProviderFactoryFromHost builds a ProviderFactory that uses the given plugin host to create providers.

type Workspace

type Workspace interface {
	// GetPlugins returns the list of plugins installed in the workspace.
	GetPlugins() ([]workspace.PluginInfo, error)
}

Workspace is the current workspace. This is used to get the list of plugins installed in the workspace. It's analogous to the workspace package, but scoped down to just the parts we need.

This should probably be used to replace a load of our currently hardcoded for real world (i.e actual file system, actual http calls) plugin workspace code, but for now we're keeping it scoped just to help out with testing the mapper code.

func DefaultWorkspace

func DefaultWorkspace() Workspace

DefaultWorkspace returns a default workspace implementation that uses the workspace module directly to get plugin info.

Jump to

Keyboard shortcuts

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