lib

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigRollout = "ConfigRollout"
	RolloutStage  = "RolloutStage"
)

Variables

View Source
var (
	ErrBadConfigExtension = errors.New("bad config extension")
	ErrNotADictionary     = errors.New("`main' returned something that's not a dict")
	ErrNotStringKey       = errors.New("`main' returned a dict with non-string key")
	ErrNoProtobufValue    = errors.New("`main' returned a dict with non-protobuf value")
)
View Source
var (
	ErrStarlarkEval = errors.New("error evaluating starlark file")
	ErrLoadStarlark = errors.New("error loading starlark file")
)
View Source
var (
	ErrMainNotCallable = errors.New("`main` must be a function")
	ErrMainNotFound    = errors.New("`main` function not found")
)
View Source
var (
	ErrLoadMutable = errors.New("error opening mutable config file")
	ErrReadMutable = errors.New("error reading from mutable config file")
)
View Source
var (
	ErrInvalidConfig = errors.New("config is not valid")
)
View Source
var ErrorRemoteRepoNoIntegrityInfo = errors.New("missing integrity data")
View Source
var ErrorRemoteRepoNotDownloaded = errors.New("remote repo not in local cache")
View Source
var ErrorRemoteRepoValidationFailed = errors.New("failed to validate integrity")

Functions

func ProgressBarConfig

func ProgressBarConfig(bar *pb.ProgressBar, prefix string)

Types

type Compiler

type Compiler struct {
	MaterializedDir string

	ModuleService *ModuleService
	// contains filtered or unexported fields
}

func NewCompiler

func NewCompiler(protoconfRoot string, verboseLogging bool) *Compiler

func (*Compiler) CompileFile

func (c *Compiler) CompileFile(filename string) error

func (*Compiler) CompileFileAsync

func (c *Compiler) CompileFileAsync(ctx context.Context, cancel context.CancelCauseFunc, filename string) (chan *protoconf_pb.CompileResponse, chan error)

func (*Compiler) GetLoader

func (c *Compiler) GetLoader() *starlarkLoader

type ModulePath

type ModulePath struct {
	Repo     string
	Filepath string
	Ext      string
}

func ParseModulePath

func ParseModulePath(moduleName string) *ModulePath

func (*ModulePath) String

func (m *ModulePath) String() string

type ModuleService

type ModuleService struct {
	Config *module.ModuleServiceConfig
	// contains filtered or unexported fields
}

func NewModuleService

func NewModuleService(protoconfRoot string) *ModuleService

func (*ModuleService) Add

func (*ModuleService) Download

func (m *ModuleService) Download(ctx context.Context, r *module.RemoteRepo) error

func (*ModuleService) DownloadDeps

func (m *ModuleService) DownloadDeps(ctx context.Context, r *module.RemoteRepo) error

DownloadDeps downloads the dependencies of a remote repository. It recursively downloads all the dependencies and their dependencies. If a module lock file exists for a dependency, it merges the lock file with the remote repository. If the lock file does not exist, it skips the dependency. The method returns an error if any error occurs during the download process.

func (*ModuleService) GenFileDescriptorSet

func (m *ModuleService) GenFileDescriptorSet(registry *utils.DescriptorRegistry, r *module.RemoteRepo) error

func (*ModuleService) GetProtoFilesRegistry

func (m *ModuleService) GetProtoFilesRegistry() *protoregistry.Files

func (*ModuleService) GetProtoRegistry

func (m *ModuleService) GetProtoRegistry() *utils.DescriptorRegistry

func (*ModuleService) Init

func (m *ModuleService) Init(ctx context.Context, initFiles ...string) error

func (*ModuleService) LoadFromLockFile

func (m *ModuleService) LoadFromLockFile() error

func (*ModuleService) Lock

func (m *ModuleService) Lock() error

func (*ModuleService) MergeLock

func (m *ModuleService) MergeLock() error

func (*ModuleService) Sync

func (m *ModuleService) Sync(ctx context.Context) error

Sync synchronizes the modules by downloading dependencies and generating file descriptor sets. It walks through each remote repository, downloads the repository if necessary, and updates the integrity of matching repositories. Then, it downloads the dependencies and generates file descriptor sets for each repository. Finally, it returns any error encountered during the process.

func (*ModuleService) Validate

func (m *ModuleService) Validate(r *module.RemoteRepo) (string, error)

func (*ModuleService) Walk

func (m *ModuleService) Walk(walkFn WalkFunction) error

type ProgressBar

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

ProgressBar wraps a github.com/cheggaaa/pb.Pool in order to display download progress for one or multiple downloads.

If two different instance of ProgressBar try to display a progress only one will be displayed. It is therefore recommended to use DefaultProgressBar

func (*ProgressBar) TrackProgress

func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser

TrackProgress instantiates a new progress bar that will display the progress of stream until closed. total can be 0.

type WalkFunction

type WalkFunction func(r *module.RemoteRepo) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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