Documentation
¶
Index ¶
- func CleanupOldTrackers(maxAge time.Duration) error
- func DeleteSyncTracker(id string) error
- func PrintSyncSummary(summaries []SyncSummary)
- type CodeSyncStats
- type CodeSyncer
- func (c *CodeSyncer) GetSyncStats(ctx context.Context, tempDir string) (*CodeSyncStats, error)
- func (c *CodeSyncer) Sync(ctx context.Context) error
- func (c *CodeSyncer) SyncNewRepository(ctx context.Context, destProvider provider.GitProvider, destTarget *SyncTarget) (*provider.Repository, error)
- func (c *CodeSyncer) ValidateRepositories(ctx context.Context) error
- type Comment
- type CreateIssueRequest
- type Issue
- type IssueSyncStats
- type IssueSyncer
- type ParallelSyncStats
- type RateLimiter
- type RepoSync
- type SyncAction
- type SyncEngine
- type SyncError
- type SyncOptions
- type SyncPlan
- type SyncProgress
- type SyncResult
- type SyncStatistics
- type SyncStatus
- type SyncSummary
- type SyncTarget
- type SyncTracker
- func (t *SyncTracker) AddError(repository, component, message string)
- func (t *SyncTracker) GetOverallProgress() float64
- func (t *SyncTracker) GetSummary() SyncSummary
- func (t *SyncTracker) HasErrors() bool
- func (t *SyncTracker) IsCompleted() bool
- func (t *SyncTracker) SetStatus(status SyncStatus)
- func (t *SyncTracker) UpdateProgress(component string, completed, failed int)
- type WikiSyncStats
- type WikiSyncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupOldTrackers ¶
CleanupOldTrackers removes trackers older than the specified duration.
func DeleteSyncTracker ¶
DeleteSyncTracker deletes a sync tracker from disk.
func PrintSyncSummary ¶
func PrintSyncSummary(summaries []SyncSummary)
PrintSyncSummary prints a formatted summary of sync operations.
Types ¶
type CodeSyncStats ¶
type CodeSyncStats struct { BranchCount int `json:"branch_count"` TagCount int `json:"tag_count"` Size string `json:"size"` }
CodeSyncStats represents statistics for code synchronization.
type CodeSyncer ¶
type CodeSyncer struct {
// contains filtered or unexported fields
}
CodeSyncer handles repository code synchronization.
func (*CodeSyncer) GetSyncStats ¶
func (c *CodeSyncer) GetSyncStats(ctx context.Context, tempDir string) (*CodeSyncStats, error)
GetSyncStats returns statistics about the code sync operation.
func (*CodeSyncer) Sync ¶
func (c *CodeSyncer) Sync(ctx context.Context) error
Sync synchronizes repository code between source and destination.
func (*CodeSyncer) SyncNewRepository ¶
func (c *CodeSyncer) SyncNewRepository(ctx context.Context, destProvider provider.GitProvider, destTarget *SyncTarget) (*provider.Repository, error)
SyncNewRepository creates and synchronizes a new repository.
func (*CodeSyncer) ValidateRepositories ¶
func (c *CodeSyncer) ValidateRepositories(ctx context.Context) error
ValidateRepositories checks if source and destination repositories are accessible.
type CreateIssueRequest ¶
type CreateIssueRequest struct { Title string Body string Labels []string Assignees []string Milestone string State string }
CreateIssueRequest represents a request to create an issue.
type Issue ¶
type Issue struct { ID string Number int Title string Body string State string Labels []string Assignees []string Milestone string URL string CreatedAt time.Time UpdatedAt time.Time Author string Comments []Comment }
Issue represents a repository issue.
type IssueSyncStats ¶
type IssueSyncStats struct { TotalMapped int `json:"total_mapped"` SourceIssues int `json:"source_issues"` CreatedIssues int `json:"created_issues"` UpdatedIssues int `json:"updated_issues"` SkippedIssues int `json:"skipped_issues"` }
IssueSyncStats represents statistics for issue synchronization.
type IssueSyncer ¶
type IssueSyncer struct {
// contains filtered or unexported fields
}
IssueSyncer handles synchronization of issues and pull requests.
func (*IssueSyncer) GetSyncStats ¶
func (i *IssueSyncer) GetSyncStats() IssueSyncStats
GetSyncStats returns statistics about issue synchronization.
func (*IssueSyncer) Sync ¶
func (i *IssueSyncer) Sync(ctx context.Context, srcRepo, dstRepo provider.Repository) error
Sync synchronizes issues between source and destination repositories.
type ParallelSyncStats ¶
type ParallelSyncStats struct { TotalTasks int `json:"total_tasks"` CompletedTasks int `json:"completed_tasks"` FailedTasks int `json:"failed_tasks"` Workers int `json:"workers"` TotalDuration time.Duration `json:"total_duration"` AverageDuration time.Duration `json:"average_duration"` }
ParallelSyncStats tracks statistics for parallel synchronization.
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter manages rate limiting for API calls during synchronization.
func NewRateLimiter ¶
func NewRateLimiter(maxConcurrent int, refillRate time.Duration) *RateLimiter
NewRateLimiter creates a new rate limiter.
func (*RateLimiter) Acquire ¶
func (rl *RateLimiter) Acquire(ctx context.Context) error
Acquire acquires a token for rate limiting.
func (*RateLimiter) Release ¶
func (rl *RateLimiter) Release()
Release releases a token back to the pool.
type RepoSync ¶
type RepoSync struct { Source provider.Repository Destination *provider.Repository // nil if creating new Actions []SyncAction }
RepoSync represents a repository synchronization task.
type SyncAction ¶
type SyncAction struct { Type string // code, issues, wiki, etc. Description string Handler func(context.Context) error }
SyncAction represents a single synchronization action.
type SyncEngine ¶
type SyncEngine struct {
// contains filtered or unexported fields
}
SyncEngine manages repository synchronization between Git platforms.
func NewSyncEngine ¶
func NewSyncEngine(src, dst provider.GitProvider, opts SyncOptions) *SyncEngine
NewSyncEngine creates a new sync engine.
type SyncError ¶
type SyncError struct { Repository string `json:"repository"` Component string `json:"component"` Message string `json:"message"` Timestamp time.Time `json:"timestamp"` }
SyncError represents an error that occurred during synchronization.
type SyncOptions ¶
type SyncOptions struct { // Source and destination From string To string // Sync options CreateMissing bool UpdateExisting bool Force bool // Include options IncludeCode bool IncludeIssues bool IncludePRs bool IncludeWiki bool IncludeReleases bool IncludeSettings bool // Filtering Match string Exclude string // Execution options Parallel int DryRun bool Verbose bool }
SyncOptions contains options for repository synchronization.
func (*SyncOptions) GetDestinationTarget ¶
func (opts *SyncOptions) GetDestinationTarget() (*SyncTarget, error)
GetDestinationTarget parses and returns the destination target.
func (*SyncOptions) GetSourceTarget ¶
func (opts *SyncOptions) GetSourceTarget() (*SyncTarget, error)
GetSourceTarget parses and returns the source target.
func (*SyncOptions) Validate ¶
func (opts *SyncOptions) Validate() error
Validate validates the sync options.
type SyncPlan ¶
type SyncPlan struct { Create []RepoSync // Repositories to create Update []RepoSync // Repositories to update Skip []RepoSync // Repositories to skip }
SyncPlan represents a synchronization plan.
type SyncProgress ¶
type SyncProgress struct { Total int `json:"total"` Completed int `json:"completed"` Failed int `json:"failed"` Progress float64 `json:"progress"` UpdatedAt time.Time `json:"updated_at"` }
SyncProgress tracks the progress of synchronization operations.
func (*SyncProgress) GetProgress ¶
func (s *SyncProgress) GetProgress() float64
GetProgress returns the current synchronization progress.
func (*SyncProgress) UpdateProgress ¶
func (s *SyncProgress) UpdateProgress(completed, failed int)
UpdateProgress updates the progress counters.
type SyncResult ¶
SyncResult represents the result of a synchronization task.
type SyncStatistics ¶
type SyncStatistics struct { TotalRepositories int `json:"total_repositories"` CompletedRepositories int `json:"completed_repositories"` FailedRepositories int `json:"failed_repositories"` SkippedRepositories int `json:"skipped_repositories"` TotalDuration time.Duration `json:"total_duration"` AverageDuration time.Duration `json:"average_duration"` BytesTransferred int64 `json:"bytes_transferred"` }
SyncStatistics contains overall sync statistics.
type SyncStatus ¶
type SyncStatus string
SyncStatus represents the overall status of a sync operation.
const ( StatusPending SyncStatus = "pending" StatusInProgress SyncStatus = "in_progress" StatusCompleted SyncStatus = "completed" StatusFailed SyncStatus = "failed" StatusCancelled SyncStatus = "cancelled" )
type SyncSummary ¶
type SyncSummary struct { ID string `json:"id"` Source string `json:"source"` Destination string `json:"destination"` Status SyncStatus `json:"status"` StartedAt time.Time `json:"started_at"` CompletedAt *time.Time `json:"completed_at,omitempty"` Duration time.Duration `json:"duration"` TotalRepositories int `json:"total_repositories"` Completed int `json:"completed"` Failed int `json:"failed"` Skipped int `json:"skipped"` Progress float64 `json:"progress"` ErrorCount int `json:"error_count"` }
SyncSummary provides a summary view of sync operations.
type SyncTarget ¶
type SyncTarget struct { Provider string Org string Repo string // empty if syncing entire organization }
SyncTarget represents a parsed sync target (provider:org/repo or provider:org).
func ParseTarget ¶
func ParseTarget(target string) (*SyncTarget, error)
ParseTarget parses a sync target string into components.
func (*SyncTarget) FullName ¶
func (t *SyncTarget) FullName() string
FullName returns the full repository name (org/repo) or just org for organization targets.
func (*SyncTarget) IsOrganization ¶
func (t *SyncTarget) IsOrganization() bool
IsOrganization returns true if this target represents an entire organization.
func (*SyncTarget) IsRepository ¶
func (t *SyncTarget) IsRepository() bool
IsRepository returns true if this target represents a specific repository.
func (*SyncTarget) String ¶
func (t *SyncTarget) String() string
String returns the string representation of the target.
type SyncTracker ¶
type SyncTracker struct { ID string `json:"id"` StartedAt time.Time `json:"started_at"` CompletedAt *time.Time `json:"completed_at,omitempty"` Source string `json:"source"` Destination string `json:"destination"` Status SyncStatus `json:"status"` Progress map[string]SyncProgress `json:"progress"` Statistics SyncStatistics `json:"statistics"` SyncOptions SyncOptions `json:"options"` Errors []SyncError `json:"errors,omitempty"` }
SyncTracker tracks synchronization progress and state.
func ListSyncTrackers ¶
func ListSyncTrackers() ([]*SyncTracker, error)
ListSyncTrackers lists all sync trackers.
func LoadSyncTracker ¶
func LoadSyncTracker(id string) (*SyncTracker, error)
LoadSyncTracker loads a sync tracker from disk.
func NewSyncTracker ¶
func NewSyncTracker(id, source, destination string, opts SyncOptions) *SyncTracker
NewSyncTracker creates a new sync tracker.
func (*SyncTracker) AddError ¶
func (t *SyncTracker) AddError(repository, component, message string)
AddError adds an error to the tracker.
func (*SyncTracker) GetOverallProgress ¶
func (t *SyncTracker) GetOverallProgress() float64
GetOverallProgress returns the overall progress percentage.
func (*SyncTracker) GetSummary ¶
func (t *SyncTracker) GetSummary() SyncSummary
GetSummary returns a summary of the sync operation.
func (*SyncTracker) HasErrors ¶
func (t *SyncTracker) HasErrors() bool
HasErrors returns true if there are any errors.
func (*SyncTracker) IsCompleted ¶
func (t *SyncTracker) IsCompleted() bool
IsCompleted returns true if the sync operation is completed.
func (*SyncTracker) SetStatus ¶
func (t *SyncTracker) SetStatus(status SyncStatus)
SetStatus updates the sync status.
func (*SyncTracker) UpdateProgress ¶
func (t *SyncTracker) UpdateProgress(component string, completed, failed int)
UpdateProgress updates the progress for a specific component.
type WikiSyncStats ¶
type WikiSyncStats struct { PageCount int `json:"page_count"` Size string `json:"size"` Pages []string `json:"pages"` }
WikiSyncStats represents statistics for wiki synchronization.
type WikiSyncer ¶
type WikiSyncer struct {
// contains filtered or unexported fields
}
WikiSyncer handles synchronization of repository wikis.
func (*WikiSyncer) Sync ¶
func (w *WikiSyncer) Sync(ctx context.Context, srcRepo, dstRepo provider.Repository) error
Sync synchronizes wiki content between source and destination repositories.
func (*WikiSyncer) ValidateWikiAccess ¶
func (w *WikiSyncer) ValidateWikiAccess(ctx context.Context, srcRepo, dstRepo provider.Repository) error
ValidateWikiAccess checks if wiki repositories are accessible.