distribution

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Example (HomebrewDistributionCoordinator)

Example_homebrewDistributionCoordinator demonstrates using Homebrew with the distribution coordinator

// Create distribution configuration
config := &DistributionConfig{
	Publishers: map[string]PublisherConfig{
		"homebrew": {
			Enabled:    true,
			Priority:   2,
			Timeout:    300000000000, // 5 minutes
			RetryCount: 3,
			Config: map[string]interface{}{
				"tap_repo":     "myorg/homebrew-tap",
				"formula_name": "nettracex",
				"description":  "Network diagnostic toolkit",
				"homepage":     "https://github.com/myorg/nettracex",
				"license":      "MIT",
				"custom_tap":   true,
			},
		},
		"github": {
			Enabled:    true,
			Priority:   1,
			Timeout:    180000000000, // 3 minutes
			RetryCount: 2,
		},
	},
	ConcurrentLimit: 2,
	RetryPolicy: RetryPolicy{
		MaxRetries: 3,
		BaseDelay:  1000000000,  // 1 second
		MaxDelay:   30000000000, // 30 seconds
		Multiplier: 2.0,
	},
}

// Create coordinator
coordinator := NewDistributionCoordinator(config)

// Create and register Homebrew publisher
homebrewConfig := HomebrewConfig{
	TapRepo:     "myorg/homebrew-tap",
	FormulaName: "nettracex",
	Description: "Network diagnostic toolkit",
	Homepage:    "https://github.com/myorg/nettracex",
	License:     "MIT",
	CustomTap:   true,
}

homebrewPublisher, err := NewHomebrewPublisher(homebrewConfig)
if err != nil {
	log.Fatalf("Failed to create Homebrew publisher: %v", err)
}

if err := coordinator.RegisterPublisher(homebrewPublisher); err != nil {
	log.Fatalf("Failed to register Homebrew publisher: %v", err)
}

// Create sample release
release := Release{
	Version: "1.1.0",
	Binaries: map[string]Binary{
		"darwin-amd64": {
			Platform:     "darwin",
			Architecture: "amd64",
			DownloadURL:  "https://github.com/myorg/nettracex/releases/download/v1.1.0/nettracex-darwin-amd64",
			Checksum:     "b2c3d4e5f6789012345678901234567890123456789012345678901234567890a1",
		},
	},
}

// Distribute to all publishers (including Homebrew)
ctx := context.Background()
if err := coordinator.Distribute(ctx, release); err != nil {
	log.Fatalf("Distribution failed: %v", err)
}

// Check publisher statuses
statuses := coordinator.GetPublisherStatus()
for name, status := range statuses {
	fmt.Printf("Publisher %s: %s\n", name, status.Status)
}
Output:

Publisher homebrew: success

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetsConfig

type AssetsConfig struct {
	IncludeBinaries  bool     `json:"include_binaries"`
	IncludeChecksums bool     `json:"include_checksums"`
	IncludeSource    bool     `json:"include_source"`
	AssetPatterns    []string `json:"asset_patterns"`
	Compression      string   `json:"compression"`
}

AssetsConfig contains asset upload settings

type Badge

type Badge struct {
	Name     string `json:"name"`
	ImageURL string `json:"image_url"`
	LinkURL  string `json:"link_url"`
	Alt      string `json:"alt"`
}

Badge represents a documentation badge

type Binary

type Binary struct {
	Platform     string `json:"platform"`
	Architecture string `json:"architecture"`
	Filename     string `json:"filename"`
	Size         int64  `json:"size"`
	Checksum     string `json:"checksum"`
	DownloadURL  string `json:"download_url"`
	FilePath     string `json:"file_path"`
}

Binary represents a platform-specific executable

type ChangelogConfig

type ChangelogConfig struct {
	AutoGenerate   bool     `json:"auto_generate"`
	Template       string   `json:"template"`
	IncludeCommits bool     `json:"include_commits"`
	IncludePRs     bool     `json:"include_prs"`
	SinceTag       string   `json:"since_tag"`
	Categories     []string `json:"categories"`
}

ChangelogConfig contains changelog generation settings

type ConsoleNotificationChannel

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

ConsoleNotificationChannel sends notifications to console

func (*ConsoleNotificationChannel) GetName

func (cnc *ConsoleNotificationChannel) GetName() string

GetName returns the channel name

func (*ConsoleNotificationChannel) IsEnabled

func (cnc *ConsoleNotificationChannel) IsEnabled() bool

IsEnabled returns whether the channel is enabled

func (*ConsoleNotificationChannel) Send

func (cnc *ConsoleNotificationChannel) Send(ctx context.Context, notification Notification) error

Send sends a notification to the console

type DefaultNotificationService

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

DefaultNotificationService provides basic notification functionality

func NewDefaultNotificationService

func NewDefaultNotificationService(config NotificationServiceConfig) *DefaultNotificationService

NewDefaultNotificationService creates a new notification service

func (*DefaultNotificationService) NotifyFailure

func (dns *DefaultNotificationService) NotifyFailure(publisher string, release Release, err error) error

NotifyFailure sends a failure notification

func (*DefaultNotificationService) NotifyProgress

func (dns *DefaultNotificationService) NotifyProgress(publisher string, release Release, progress float64) error

NotifyProgress sends a progress notification

func (*DefaultNotificationService) NotifySuccess

func (dns *DefaultNotificationService) NotifySuccess(publisher string, release Release) error

NotifySuccess sends a success notification

func (*DefaultNotificationService) RegisterChannel

func (dns *DefaultNotificationService) RegisterChannel(channel NotificationChannel)

RegisterChannel registers a new notification channel

type Dependency

type Dependency struct {
	Path    string `json:"path"`
	Version string `json:"version"`
	Type    string `json:"type"` // direct, indirect, test
}

Dependency represents a Go module dependency

type DistributionConfig

type DistributionConfig struct {
	Publishers      map[string]PublisherConfig `json:"publishers"`
	Validators      map[string]ValidatorConfig `json:"validators"`
	Notifications   NotificationConfig         `json:"notifications"`
	RetryPolicy     RetryPolicy                `json:"retry_policy"`
	ConcurrentLimit int                        `json:"concurrent_limit"`
}

DistributionConfig contains configuration for distribution

type DistributionCoordinator

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

DistributionCoordinator manages cross-platform package publishing

func NewDistributionCoordinator

func NewDistributionCoordinator(config *DistributionConfig) *DistributionCoordinator

NewDistributionCoordinator creates a new distribution coordinator

func (*DistributionCoordinator) Distribute

func (dc *DistributionCoordinator) Distribute(ctx context.Context, release Release) error

Distribute publishes a release to all configured publishers

func (*DistributionCoordinator) GetPublisherStatus

func (dc *DistributionCoordinator) GetPublisherStatus() map[string]PublishStatus

GetPublisherStatus returns the status of all publishers

func (*DistributionCoordinator) RegisterPublisher

func (dc *DistributionCoordinator) RegisterPublisher(publisher Publisher) error

RegisterPublisher registers a new publisher

func (*DistributionCoordinator) RegisterValidator

func (dc *DistributionCoordinator) RegisterValidator(validator Validator) error

RegisterValidator registers a new validator

func (*DistributionCoordinator) SetNotificationService

func (dc *DistributionCoordinator) SetNotificationService(service NotificationService)

SetNotificationService sets the notification service

type DistributionReport

type DistributionReport struct {
	Release         Release                  `json:"release"`
	StartTime       time.Time                `json:"start_time"`
	EndTime         time.Time                `json:"end_time"`
	Duration        time.Duration            `json:"duration"`
	TotalPublishers int                      `json:"total_publishers"`
	SuccessCount    int                      `json:"success_count"`
	ErrorCount      int                      `json:"error_count"`
	Results         map[string]PublishResult `json:"results"`
	Summary         string                   `json:"summary"`
}

DistributionReport contains a summary of distribution results

type Documentation

type Documentation struct {
	README   string            `json:"readme"`
	GoDoc    string            `json:"godoc"`
	Examples []Example         `json:"examples"`
	Badges   []Badge           `json:"badges"`
	Links    map[string]string `json:"links"`
}

Documentation contains module documentation information

type DocumentationConfig

type DocumentationConfig struct {
	GenerateReadme   bool     `json:"generate_readme"`
	GenerateExamples bool     `json:"generate_examples"`
	IncludeBadges    bool     `json:"include_badges"`
	BadgeTypes       []string `json:"badge_types"`
	UpdateGoDoc      bool     `json:"update_godoc"`
}

DocumentationConfig contains documentation generation settings

type Example

type Example struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Code        string `json:"code"`
	Output      string `json:"output"`
	Runnable    bool   `json:"runnable"`
}

Example represents a code example

type ExamplesConfig

type ExamplesConfig struct {
	AutoGenerate  bool     `json:"auto_generate"`
	ExampleDirs   []string `json:"example_dirs"`
	TestExamples  bool     `json:"test_examples"`
	IncludeOutput bool     `json:"include_output"`
}

ExamplesConfig contains example generation settings

type GitHubAsset

type GitHubAsset struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	ContentType string `json:"content_type"`
	Size        int64  `json:"size"`
	DownloadURL string `json:"download_url"`
	FilePath    string `json:"file_path"`
}

GitHubAsset represents a GitHub release asset

type GitHubAssetResp

type GitHubAssetResp struct {
	ID                 int64     `json:"id"`
	Name               string    `json:"name"`
	Label              string    `json:"label"`
	ContentType        string    `json:"content_type"`
	Size               int64     `json:"size"`
	DownloadCount      int64     `json:"download_count"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	BrowserDownloadURL string    `json:"browser_download_url"`
}

GitHubAssetResp represents a GitHub release asset response

type GitHubConfig

type GitHubConfig struct {
	Owner     string            `json:"owner"`
	Repo      string            `json:"repo"`
	Token     string            `json:"token"`
	BaseURL   string            `json:"base_url"`
	Timeout   time.Duration     `json:"timeout"`
	Changelog ChangelogConfig   `json:"changelog"`
	Assets    AssetsConfig      `json:"assets"`
	Metadata  map[string]string `json:"metadata"`
}

GitHubConfig contains configuration for GitHub publishing

type GitHubPublisher

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

GitHubPublisher handles GitHub release publishing

func NewGitHubPublisher

func NewGitHubPublisher(config GitHubConfig) *GitHubPublisher

NewGitHubPublisher creates a new GitHub publisher

func (*GitHubPublisher) GetName

func (ghp *GitHubPublisher) GetName() string

GetName returns the publisher name

func (*GitHubPublisher) GetStatus

func (ghp *GitHubPublisher) GetStatus() PublishStatus

GetStatus returns the current publisher status

func (*GitHubPublisher) Publish

func (ghp *GitHubPublisher) Publish(ctx context.Context, release Release) error

Publish publishes the release to GitHub

func (*GitHubPublisher) Validate

func (ghp *GitHubPublisher) Validate(ctx context.Context, release Release) error

Validate validates the release for GitHub publishing

type GitHubRelease

type GitHubRelease struct {
	TagName         string `json:"tag_name"`
	TargetCommitish string `json:"target_commitish"`
	Name            string `json:"name"`
	Body            string `json:"body"`
	Draft           bool   `json:"draft"`
	Prerelease      bool   `json:"prerelease"`
	GenerateNotes   bool   `json:"generate_release_notes"`
}

GitHubRelease represents a GitHub release

type GitHubReleaseInfo

type GitHubReleaseInfo struct {
	Owner        string            `json:"owner"`
	Repo         string            `json:"repo"`
	TagName      string            `json:"tag_name"`
	Name         string            `json:"name"`
	Body         string            `json:"body"`
	Draft        bool              `json:"draft"`
	Prerelease   bool              `json:"prerelease"`
	Assets       []GitHubAsset     `json:"assets"`
	TargetCommit string            `json:"target_commit"`
	Metadata     map[string]string `json:"metadata"`
}

GitHubReleaseInfo contains GitHub release specific information

type GitHubReleaseResponse

type GitHubReleaseResponse struct {
	ID          int64             `json:"id"`
	TagName     string            `json:"tag_name"`
	Name        string            `json:"name"`
	Body        string            `json:"body"`
	Draft       bool              `json:"draft"`
	Prerelease  bool              `json:"prerelease"`
	CreatedAt   time.Time         `json:"created_at"`
	PublishedAt time.Time         `json:"published_at"`
	HTMLURL     string            `json:"html_url"`
	UploadURL   string            `json:"upload_url"`
	Assets      []GitHubAssetResp `json:"assets"`
}

GitHubReleaseResponse represents GitHub API response

type GitHubValidator

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

GitHubValidator validates GitHub releases

func NewGitHubValidator

func NewGitHubValidator(config GitHubValidatorConfig) *GitHubValidator

NewGitHubValidator creates a new GitHub validator

func (*GitHubValidator) GetName

func (ghv *GitHubValidator) GetName() string

GetName returns the validator name

func (*GitHubValidator) Validate

func (ghv *GitHubValidator) Validate(ctx context.Context, release Release) error

Validate validates a release

func (*GitHubValidator) ValidateRelease

func (ghv *GitHubValidator) ValidateRelease(ctx context.Context, release Release) (*PackageValidationResult, error)

ValidateRelease validates a release for GitHub publishing

type GitHubValidatorConfig

type GitHubValidatorConfig struct {
	CheckAssets    bool     `json:"check_assets"`
	CheckChangelog bool     `json:"check_changelog"`
	CheckTag       bool     `json:"check_tag"`
	RequiredAssets []string `json:"required_assets"`
}

GitHubValidatorConfig contains validator configuration

type GoModuleConfig

type GoModuleConfig struct {
	ModulePath    string              `json:"module_path"`
	ProxyURL      string              `json:"proxy_url"`
	SumDBURL      string              `json:"sumdb_url"`
	Timeout       time.Duration       `json:"timeout"`
	Documentation DocumentationConfig `json:"documentation"`
	Examples      ExamplesConfig      `json:"examples"`
	Metadata      map[string]string   `json:"metadata"`
}

GoModuleConfig contains configuration for Go module publishing

type GoModuleInfo

type GoModuleInfo struct {
	ModulePath    string            `json:"module_path"`
	Version       string            `json:"version"`
	GoVersion     string            `json:"go_version"`
	Dependencies  []Dependency      `json:"dependencies"`
	Documentation Documentation     `json:"documentation"`
	Examples      []Example         `json:"examples"`
	Metadata      map[string]string `json:"metadata"`
}

GoModuleInfo contains Go module specific information

type GoModulePublisher

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

GoModulePublisher handles Go module publishing to pkg.go.dev

func NewGoModulePublisher

func NewGoModulePublisher(config GoModuleConfig) *GoModulePublisher

NewGoModulePublisher creates a new Go module publisher

func (*GoModulePublisher) GetName

func (gmp *GoModulePublisher) GetName() string

GetName returns the publisher name

func (*GoModulePublisher) GetStatus

func (gmp *GoModulePublisher) GetStatus() PublishStatus

GetStatus returns the current publisher status

func (*GoModulePublisher) Publish

func (gmp *GoModulePublisher) Publish(ctx context.Context, release Release) error

Publish publishes the Go module to pkg.go.dev

func (*GoModulePublisher) Validate

func (gmp *GoModulePublisher) Validate(ctx context.Context, release Release) error

Validate validates the release for Go module publishing

type GoModuleValidator

type GoModuleValidator struct {

	// Function field for testing
	ValidateRelease func(ctx context.Context, release Release) (*PackageValidationResult, error)
	// contains filtered or unexported fields
}

GoModuleValidator validates Go modules

func NewGoModuleValidator

func NewGoModuleValidator(config GoModuleValidatorConfig) *GoModuleValidator

NewGoModuleValidator creates a new Go module validator

func (*GoModuleValidator) GetName

func (gmv *GoModuleValidator) GetName() string

GetName returns the validator name

func (*GoModuleValidator) Validate

func (gmv *GoModuleValidator) Validate(ctx context.Context, release Release) error

Validate validates a release

type GoModuleValidatorConfig

type GoModuleValidatorConfig struct {
	CheckSyntax        bool    `json:"check_syntax"`
	CheckDependencies  bool    `json:"check_dependencies"`
	CheckLicense       bool    `json:"check_license"`
	CheckDocumentation bool    `json:"check_documentation"`
	MinCoverage        float64 `json:"min_coverage"`
}

GoModuleValidatorConfig contains validator configuration

type HomebrewConfig

type HomebrewConfig struct {
	TapRepo      string   `json:"tap_repo"`     // e.g., "username/homebrew-tap"
	FormulaName  string   `json:"formula_name"` // e.g., "nettracex"
	GitHubToken  string   `json:"github_token"`
	Description  string   `json:"description"`
	Homepage     string   `json:"homepage"`
	License      string   `json:"license"`
	TestCommand  string   `json:"test_command"`
	Dependencies []string `json:"dependencies"`
	CustomTap    bool     `json:"custom_tap"` // true for custom tap, false for homebrew-core
}

HomebrewConfig contains Homebrew publishing configuration

type HomebrewFormula

type HomebrewFormula struct {
	Class        string            `json:"class"`
	Description  string            `json:"description"`
	Homepage     string            `json:"homepage"`
	URL          string            `json:"url"`
	SHA256       string            `json:"sha256"`
	License      string            `json:"license"`
	Dependencies []string          `json:"dependencies"`
	TestBlock    string            `json:"test_block"`
	Version      string            `json:"version"`
	Metadata     map[string]string `json:"metadata"`
	// Multi-platform support
	PlatformURLs map[string]PlatformBinary `json:"platform_urls,omitempty"`
}

HomebrewFormula represents a complete Homebrew formula

Example

ExampleHomebrewFormula demonstrates formula generation

config := HomebrewConfig{
	FormulaName: "nettracex",
	Description: "Network diagnostic toolkit",
	Homepage:    "https://github.com/myorg/nettracex",
	License:     "MIT",
	TestCommand: `"--help"`,
}

publisher, _ := NewHomebrewPublisher(config)

release := Release{
	Version: "2.0.0",
	Binaries: map[string]Binary{
		"darwin-amd64": {
			Platform:     "darwin",
			Architecture: "amd64",
			Filename:     "nettracex",
			DownloadURL:  "https://github.com/myorg/nettracex/releases/download/v2.0.0/nettracex-darwin-amd64.tar.gz",
			Checksum:     "c3d4e5f6789012345678901234567890123456789012345678901234567890a1b2",
		},
	},
}

// Generate formula
formula, err := publisher.GenerateFormula(release)
if err != nil {
	log.Fatalf("Failed to generate formula: %v", err)
}

// Render formula to Ruby code
content, err := publisher.RenderFormula(formula)
if err != nil {
	log.Fatalf("Failed to render formula: %v", err)
}

fmt.Printf("Generated formula:\n%s\n", content)

// Output will be a complete Homebrew formula in Ruby format

type HomebrewPublisher

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

HomebrewPublisher manages Homebrew formula creation and publishing

Example

ExampleHomebrewPublisher demonstrates how to use the Homebrew publisher

// Configure Homebrew publisher
config := HomebrewConfig{
	TapRepo:      "myorg/homebrew-tap",
	FormulaName:  "nettracex",
	Description:  "Network diagnostic toolkit with beautiful TUI",
	Homepage:     "https://github.com/myorg/nettracex",
	License:      "MIT",
	CustomTap:    true,
	TestCommand:  `"--version"`,
	Dependencies: []string{}, // No dependencies required
}

// Create publisher
publisher, err := NewHomebrewPublisher(config)
if err != nil {
	log.Fatalf("Failed to create Homebrew publisher: %v", err)
}

// Create a sample release
release := Release{
	Version: "1.0.0",
	Tag:     "v1.0.0",
	Binaries: map[string]Binary{
		"darwin-amd64": {
			Platform:     "darwin",
			Architecture: "amd64",
			Filename:     "nettracex",
			DownloadURL:  "https://httpbin.org/bytes/1024",
			Checksum:     "", // Will be calculated
			Size:         1024000,
		},
	},
	Changelog:    "Initial release with WHOIS, ping, and traceroute functionality",
	ReleaseNotes: "First stable release of NetTraceX",
}

ctx := context.Background()

// Validate the release
if err := publisher.Validate(ctx, release); err != nil {
	log.Fatalf("Release validation failed: %v", err)
}

// Publish to Homebrew
if err := publisher.Publish(ctx, release); err != nil {
	log.Fatalf("Failed to publish to Homebrew: %v", err)
}

// Check status
status := publisher.GetStatus()
fmt.Printf("Publisher: %s, Status: %s\n", status.Name, status.Status)
Output:

Publisher: homebrew, Status: success

func NewHomebrewPublisher

func NewHomebrewPublisher(config HomebrewConfig) (*HomebrewPublisher, error)

NewHomebrewPublisher creates a new Homebrew publisher

func (*HomebrewPublisher) GenerateFormula

func (p *HomebrewPublisher) GenerateFormula(release Release) (*HomebrewFormula, error)

GenerateFormula creates a Homebrew formula from a release

func (*HomebrewPublisher) GetName

func (p *HomebrewPublisher) GetName() string

GetName returns the publisher name

func (*HomebrewPublisher) GetStatus

func (p *HomebrewPublisher) GetStatus() PublishStatus

GetStatus returns the current status of the Homebrew publisher

func (*HomebrewPublisher) Publish

func (p *HomebrewPublisher) Publish(ctx context.Context, release Release) error

Publish publishes a release to Homebrew

func (*HomebrewPublisher) RenderFormula

func (p *HomebrewPublisher) RenderFormula(formula *HomebrewFormula) (string, error)

RenderFormula renders the formula to Ruby code

func (*HomebrewPublisher) Validate

func (p *HomebrewPublisher) Validate(ctx context.Context, release Release) error

Validate validates a release for Homebrew publishing

type HomebrewValidator

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

HomebrewValidator validates Homebrew formulas

Example

ExampleHomebrewValidator demonstrates formula validation

validator, err := NewHomebrewValidator()
if err != nil {
	log.Fatalf("Failed to create validator: %v", err)
}

// Create a sample formula
formula := &HomebrewFormula{
	Class:       "Nettracex",
	Description: "Network diagnostic toolkit",
	Homepage:    "https://github.com/myorg/nettracex",
	URL:         "https://github.com/myorg/nettracex/releases/download/v1.0.0/nettracex-darwin-amd64",
	SHA256:      "a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890",
	License:     "MIT",
	Version:     "1.0.0",
	TestBlock:   `system "#{bin}/nettracex", "--version"`,
}

// Validate the formula
if err := validator.ValidateFormula(formula); err != nil {
	log.Fatalf("Formula validation failed: %v", err)
}

fmt.Println("Formula validation passed")
Output:

Formula validation passed

func NewHomebrewValidator

func NewHomebrewValidator() (*HomebrewValidator, error)

NewHomebrewValidator creates a new Homebrew validator

func (*HomebrewValidator) ValidateFormula

func (v *HomebrewValidator) ValidateFormula(formula *HomebrewFormula) error

ValidateFormula validates a Homebrew formula

type LogNotificationChannel

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

LogNotificationChannel sends notifications to the log

func (*LogNotificationChannel) GetName

func (lnc *LogNotificationChannel) GetName() string

GetName returns the channel name

func (*LogNotificationChannel) IsEnabled

func (lnc *LogNotificationChannel) IsEnabled() bool

IsEnabled returns whether the channel is enabled

func (*LogNotificationChannel) Send

func (lnc *LogNotificationChannel) Send(ctx context.Context, notification Notification) error

Send sends a notification to the log

type Notification

type Notification struct {
	Type      NotificationType       `json:"type"`
	Title     string                 `json:"title"`
	Message   string                 `json:"message"`
	Publisher string                 `json:"publisher"`
	Release   Release                `json:"release"`
	Error     error                  `json:"error,omitempty"`
	Metadata  map[string]interface{} `json:"metadata"`
	Timestamp time.Time              `json:"timestamp"`
}

Notification represents a notification message

type NotificationChannel

type NotificationChannel interface {
	Send(ctx context.Context, notification Notification) error
	GetName() string
	IsEnabled() bool
}

NotificationChannel defines the interface for notification channels

type NotificationChannelConfig

type NotificationChannelConfig struct {
	Type     string                 `json:"type"`
	Enabled  bool                   `json:"enabled"`
	Config   map[string]interface{} `json:"config"`
	Priority int                    `json:"priority"`
}

NotificationChannelConfig contains channel-specific configuration

type NotificationConfig

type NotificationConfig struct {
	Enabled   bool     `json:"enabled"`
	Channels  []string `json:"channels"`
	OnError   bool     `json:"on_error"`
	OnSuccess bool     `json:"on_success"`
}

NotificationConfig contains notification settings

type NotificationRetryPolicy

type NotificationRetryPolicy struct {
	MaxRetries int           `json:"max_retries"`
	BaseDelay  time.Duration `json:"base_delay"`
	MaxDelay   time.Duration `json:"max_delay"`
}

NotificationRetryPolicy defines retry behavior for notifications

type NotificationService

type NotificationService interface {
	NotifySuccess(publisher string, release Release) error
	NotifyFailure(publisher string, release Release, err error) error
	NotifyProgress(publisher string, release Release, progress float64) error
}

NotificationService handles publishing notifications

type NotificationServiceConfig

type NotificationServiceConfig struct {
	Enabled     bool                                 `json:"enabled"`
	Channels    map[string]NotificationChannelConfig `json:"channels"`
	Templates   map[string]string                    `json:"templates"`
	RetryPolicy NotificationRetryPolicy              `json:"retry_policy"`
}

NotificationServiceConfig contains notification service configuration

type NotificationType

type NotificationType string

NotificationType represents the type of notification

const (
	NotificationTypeSuccess  NotificationType = "success"
	NotificationTypeFailure  NotificationType = "failure"
	NotificationTypeProgress NotificationType = "progress"
	NotificationTypeInfo     NotificationType = "info"
	NotificationTypeWarning  NotificationType = "warning"
)

type PackageValidationResult

type PackageValidationResult struct {
	Valid    bool              `json:"valid"`
	Errors   []ValidationError `json:"errors"`
	Warnings []ValidationError `json:"warnings"`
	Metadata map[string]string `json:"metadata"`
}

PackageValidationResult contains validation results

type PlatformBinary

type PlatformBinary struct {
	URL    string `json:"url"`
	SHA256 string `json:"sha256"`
}

PlatformBinary represents a platform-specific binary

type PublishResult

type PublishResult struct {
	Success     bool              `json:"success"`
	Publisher   string            `json:"publisher"`
	Release     Release           `json:"release"`
	PublishedAt time.Time         `json:"published_at"`
	URL         string            `json:"url"`
	Errors      []string          `json:"errors"`
	Warnings    []string          `json:"warnings"`
	Metadata    map[string]string `json:"metadata"`
}

PublishResult contains the result of a publish operation

type PublishStatus

type PublishStatus struct {
	Name         string            `json:"name"`
	Status       StatusType        `json:"status"`
	LastPublish  time.Time         `json:"last_publish"`
	LastError    string            `json:"last_error"`
	PublishCount int               `json:"publish_count"`
	ErrorCount   int               `json:"error_count"`
	Metadata     map[string]string `json:"metadata"`
}

PublishStatus represents the status of a publisher

type Publisher

type Publisher interface {
	Publish(ctx context.Context, release Release) error
	Validate(ctx context.Context, release Release) error
	GetStatus() PublishStatus
	GetName() string
}

Publisher defines the interface for package publishers

type PublisherConfig

type PublisherConfig struct {
	Enabled    bool                   `json:"enabled"`
	Priority   int                    `json:"priority"`
	Timeout    time.Duration          `json:"timeout"`
	RetryCount int                    `json:"retry_count"`
	Config     map[string]interface{} `json:"config"`
}

PublisherConfig contains publisher-specific configuration

type Release

type Release struct {
	Version      string            `json:"version"`
	Tag          string            `json:"tag"`
	Binaries     map[string]Binary `json:"binaries"`
	Checksums    map[string]string `json:"checksums"`
	Changelog    string            `json:"changelog"`
	ReleaseNotes string            `json:"release_notes"`
	Metadata     ReleaseMetadata   `json:"metadata"`
}

Release represents a software release across all platforms

type ReleaseMetadata

type ReleaseMetadata struct {
	CreatedAt    time.Time         `json:"created_at"`
	Author       string            `json:"author"`
	CommitSHA    string            `json:"commit_sha"`
	BuildNumber  string            `json:"build_number"`
	IsPrerelease bool              `json:"is_prerelease"`
	Tags         []string          `json:"tags"`
	Assets       map[string]string `json:"assets"`
}

ReleaseMetadata contains additional release information

type RetryPolicy

type RetryPolicy struct {
	MaxRetries int           `json:"max_retries"`
	BaseDelay  time.Duration `json:"base_delay"`
	MaxDelay   time.Duration `json:"max_delay"`
	Multiplier float64       `json:"multiplier"`
}

RetryPolicy defines retry behavior

type StatusType

type StatusType string

StatusType represents the current status of a publisher

const (
	StatusIdle       StatusType = "idle"
	StatusPublishing StatusType = "publishing"
	StatusSuccess    StatusType = "success"
	StatusError      StatusType = "error"
	StatusDisabled   StatusType = "disabled"
)

type ValidationError

type ValidationError struct {
	Code       string `json:"code"`
	Message    string `json:"message"`
	Field      string `json:"field"`
	Severity   string `json:"severity"`
	Suggestion string `json:"suggestion"`
}

ValidationError represents a validation error or warning

type Validator

type Validator interface {
	Validate(ctx context.Context, release Release) error
	GetName() string
}

Validator defines the interface for release validators

type ValidatorConfig

type ValidatorConfig struct {
	Enabled bool                   `json:"enabled"`
	Config  map[string]interface{} `json:"config"`
}

ValidatorConfig contains validator-specific configuration

Jump to

Keyboard shortcuts

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