Documentation
¶
Index ¶
- type BuildOptions
- type BuildPlan
- type BuildResult
- type Builder
- type CacheEntry
- type CacheManager
- type DependencyGraph
- type DependencyResolver
- type Enum
- type EnumValue
- type ExecutionPlan
- type ExecutionResult
- type Executor
- type Field
- type Logger
- type Message
- type Method
- type Option
- func WithCache(c CacheManager) Option
- func WithExecutor(e Executor) Option
- func WithLogger(log *logger.Logger) Option
- func WithMetrics(m *metrics.Collector) Option
- func WithParser(p ProtoParser) Option
- func WithPluginRegistry(registry *plugin.Registry) Option
- func WithResolver(r DependencyResolver) Option
- type ProtoFile
- type ProtoParser
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildOptions ¶
type BuildOptions struct {
// Workers is the number of parallel workers (0 = auto)
Workers int
// Incremental enables incremental builds
Incremental bool
// Cache enables caching
Cache bool
// CacheDir is the cache directory
CacheDir string
// DryRun only shows what would be built
DryRun bool
// Verbose enables verbose logging
Verbose bool
}
BuildOptions contains build configuration
type BuildPlan ¶
type BuildPlan struct {
// ProtoFiles is the list of proto files to compile
ProtoFiles []string
// ImportPaths are additional import paths
ImportPaths []string
// OutputDir is the base output directory
OutputDir string
// Languages are the target languages
Languages []string
// Options are additional build options
Options BuildOptions
}
BuildPlan describes what to build
type BuildResult ¶
type BuildResult struct {
// Success indicates if build was successful
Success bool
// Duration is the total build time
Duration time.Duration
// FilesProcessed is the number of files processed
FilesProcessed int
// FilesGenerated is the number of generated files
FilesGenerated int
// Errors contains any build errors
Errors []error
// Warnings contains build warnings
Warnings []string
// CacheHits is the number of cache hits
CacheHits int
// CacheMisses is the number of cache misses
CacheMisses int
}
BuildResult contains build results
type Builder ¶
type Builder interface {
// Build executes the build process
Build(ctx context.Context, plan *BuildPlan) (*BuildResult, error)
// GetMetrics returns build metrics
GetMetrics() *metrics.Collector
}
Builder is the main interface for building protobuf files
type CacheEntry ¶
type CacheEntry struct {
// File is the proto file path
File string
// Hash is the file content hash
Hash string
// DepsHash is the dependencies hash
DepsHash string
// Languages are the generated languages
Languages []string
// GeneratedFiles are the generated file paths
GeneratedFiles []string
}
CacheEntry represents a cached build result
type CacheManager ¶
type CacheManager interface {
// Check checks cache for files
Check(ctx context.Context, files []*ProtoFile) (hits int, misses int)
// Get retrieves cache entry for a file
Get(ctx context.Context, file *ProtoFile) (*CacheEntry, error)
// Put stores cache entry
Put(ctx context.Context, entry *CacheEntry) error
// Invalidate removes cache entry
Invalidate(ctx context.Context, file string) error
// Clear clears all cache
Clear(ctx context.Context) error
}
CacheManager manages build cache
func NewCacheManager ¶
func NewCacheManager(log Logger) CacheManager
NewCacheManager creates a new CacheManager
type DependencyGraph ¶
type DependencyGraph struct {
// Nodes are the proto files
Nodes map[string]*ProtoFile
// Edges represent dependencies (file -> dependencies)
Edges map[string][]string
// CompilationOrder is the topologically sorted order
CompilationOrder []string
}
DependencyGraph represents the dependency graph of proto files
func (*DependencyGraph) GetDependencies ¶
func (g *DependencyGraph) GetDependencies(path string) []string
GetDependencies returns direct dependencies of a file
func (*DependencyGraph) GetTransitiveDependencies ¶
func (g *DependencyGraph) GetTransitiveDependencies(path string) []string
GetTransitiveDependencies returns all transitive dependencies
func (*DependencyGraph) Validate ¶
func (g *DependencyGraph) Validate() error
Validate checks if the graph is valid
type DependencyResolver ¶
type DependencyResolver interface {
// Resolve builds the dependency graph and determines compilation order
Resolve(ctx context.Context, files []*ProtoFile) (*DependencyGraph, error)
}
DependencyResolver resolves proto file dependencies
func NewDependencyResolver ¶
func NewDependencyResolver(log Logger) DependencyResolver
NewDependencyResolver creates a new DependencyResolver
type ExecutionPlan ¶
type ExecutionPlan struct {
// Graph is the dependency graph
Graph *DependencyGraph
// OutputDir is the output directory
OutputDir string
// ImportPaths are the import paths for protoc
ImportPaths []string
// Languages are the target languages
Languages []string
// Options are build options
Options BuildOptions
}
ExecutionPlan describes how to execute the build
type ExecutionResult ¶
type ExecutionResult struct {
// FilesGenerated is the number of generated files
FilesGenerated int
// Warnings contains execution warnings
Warnings []string
// Metrics contains execution metrics
Metrics map[string]interface{}
}
ExecutionResult contains execution results
type Executor ¶
type Executor interface {
// Execute runs the build execution
Execute(ctx context.Context, plan *ExecutionPlan) (*ExecutionResult, error)
}
Executor executes the build plan
type Logger ¶
type Logger interface {
Debug(msg string, args ...interface{})
Info(msg string, args ...interface{})
Warn(msg string, args ...interface{})
Error(msg string, args ...interface{})
}
Logger is a minimal interface for logging
func NewLoggerAdapter ¶
NewLoggerAdapter creates a new logger adapter
type Option ¶
type Option func(*builder) error
Option is a functional option for Builder
func WithMetrics ¶
WithMetrics sets the metrics collector
func WithPluginRegistry ¶ added in v1.0.0
WithPluginRegistry sets the plugin registry
func WithResolver ¶
func WithResolver(r DependencyResolver) Option
WithResolver sets the dependency resolver
type ProtoFile ¶
type ProtoFile struct {
// Path is the file path
Path string
// Package is the proto package name
Package string
// Syntax is the proto syntax version (proto2 or proto3)
Syntax string
// Imports are the imported proto files
Imports []string
// Services are the defined services
Services []Service
// Messages are the defined messages
Messages []Message
// Enums are the defined enums
Enums []Enum
// Options are file-level options
Options map[string]string
}
ProtoFile represents a parsed proto file
type ProtoParser ¶
type ProtoParser interface {
// ParseFiles parses multiple proto files
ParseFiles(ctx context.Context, files []string, importPaths []string) ([]*ProtoFile, error)
// ParseFile parses a single proto file
ParseFile(ctx context.Context, path string, importPaths []string) (*ProtoFile, error)
}
ProtoParser parses proto files
func NewProtoParser ¶
func NewProtoParser(log Logger) ProtoParser
NewProtoParser creates a new ProtoParser