importexport

package
v0.0.0-...-dc8f43e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunIntegrationTests

func RunIntegrationTests() error

RunIntegrationTests runs all integration tests

Types

type BackupManager

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

BackupManager handles backup and restore operations

func NewBackupManager

func NewBackupManager(repo *govc.Repository) *BackupManager

NewBackupManager creates a new backup manager

func (*BackupManager) Backup

func (bm *BackupManager) Backup(ctx context.Context, opts BackupOptions) error

Backup creates a backup of the repository

func (*BackupManager) GetProgress

func (bm *BackupManager) GetProgress() BackupProgress

GetProgress returns current progress

func (*BackupManager) Restore

func (bm *BackupManager) Restore(ctx context.Context, backupPath string, opts RestoreOptions) error

Restore restores a repository from backup

func (*BackupManager) VerifyBackup

func (bm *BackupManager) VerifyBackup(backupPath string) error

VerifyBackup verifies the integrity of a backup file

type BackupMetadata

type BackupMetadata struct {
	Version     string    `json:"version"`
	CreatedAt   time.Time `json:"created_at"`
	Repository  string    `json:"repository"`
	Description string    `json:"description"`
	Checksum    string    `json:"checksum"`
	Size        int64     `json:"size"`
	Format      string    `json:"format"`
	Compression string    `json:"compression"`
	Branches    []string  `json:"branches"`
	Tags        []string  `json:"tags"`
	Commits     int       `json:"commits"`
}

BackupMetadata contains backup information

func ListBackups

func ListBackups(backupDir string) ([]BackupMetadata, error)

ListBackups lists available backups in a directory

type BackupOptions

type BackupOptions struct {
	Output      string            `json:"output"`      // Output file path
	Compression bool              `json:"compression"` // Enable gzip compression
	Incremental bool              `json:"incremental"` // Incremental backup
	Since       *time.Time        `json:"since"`       // Backup changes since this time
	Include     []string          `json:"include"`     // Include patterns
	Exclude     []string          `json:"exclude"`     // Exclude patterns
	Metadata    map[string]string `json:"metadata"`    // Custom metadata
	Encryption  *EncryptionConfig `json:"encryption"`  // Encryption settings
}

BackupOptions contains backup configuration

type BackupProgress

type BackupProgress struct {
	CurrentPhase   string
	TotalFiles     int
	ProcessedFiles int
	TotalSize      int64
	ProcessedSize  int64
	StartTime      time.Time
	EstimatedTime  time.Duration
	Errors         []error
}

BackupProgress tracks backup/restore progress

type BatchMigrationConfig

type BatchMigrationConfig struct {
	Organizations []string          `yaml:"organizations"`
	Repositories  []string          `yaml:"repositories"`
	Mapping       map[string]string `yaml:"mapping"` // old name -> new name
	Parallel      int               `yaml:"parallel"`
	RetryCount    int               `yaml:"retry_count"`
}

BatchMigrationConfig contains configuration for batch migrations

type CommitData

type CommitData struct {
	Hash      string      `json:"hash"`
	Tree      string      `json:"tree"`
	Parents   []string    `json:"parents"`
	Author    govc.Author `json:"author"`
	Committer govc.Author `json:"committer"`
	Message   string      `json:"message"`
}

CommitData represents a parsed Git commit object

type EncryptionConfig

type EncryptionConfig struct {
	Enabled   bool   `json:"enabled"`
	Algorithm string `json:"algorithm"` // AES-256-GCM
	KeyFile   string `json:"key_file"`
	Password  string `json:"password,omitempty"`
}

EncryptionConfig contains encryption settings

type ExportOptions

type ExportOptions struct {
	Bare           bool   // Export as bare repository
	Branch         string // Specific branch to export
	IncludeTags    bool   // Include tags in export
	IncludeHistory bool   // Include full history or just current state
}

ExportOptions contains options for exporting

type ExportProgress

type ExportProgress struct {
	TotalCommits    int
	ExportedCommits int
	CurrentPhase    string
	Errors          []error
}

ExportProgress tracks export progress

type GitExporter

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

GitExporter exports govc repositories to standard Git format

func NewGitExporter

func NewGitExporter(govcRepo *govc.Repository, exportPath string) *GitExporter

NewGitExporter creates a new Git exporter

func (*GitExporter) Export

func (ge *GitExporter) Export() error

Export performs the full export from govc to Git

func (*GitExporter) ExportWithOptions

func (ge *GitExporter) ExportWithOptions(opts ExportOptions) error

ExportWithOptions exports with specific options

func (*GitExporter) GetProgress

func (ge *GitExporter) GetProgress() ExportProgress

GetProgress returns the current export progress

type GitHubRepo

type GitHubRepo struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	FullName    string `json:"full_name"`
	CloneURL    string `json:"clone_url"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	Fork        bool   `json:"fork"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

GitHubRepo represents a GitHub repository

type GitImporter

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

GitImporter imports standard Git repositories into govc format

func NewGitImporter

func NewGitImporter(govcRepo *govc.Repository, gitRepoPath string) *GitImporter

NewGitImporter creates a new Git importer

func (*GitImporter) GetProgress

func (gi *GitImporter) GetProgress() ImportProgress

GetProgress returns the current import progress

func (*GitImporter) Import

func (gi *GitImporter) Import() error

Import performs the full import from Git to govc

type GitLabProject

type GitLabProject struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	Path          string `json:"path"`
	HTTPURLToRepo string `json:"http_url_to_repo"`
	Description   string `json:"description"`
	Visibility    string `json:"visibility"`
	CreatedAt     string `json:"created_at"`
	LastActivity  string `json:"last_activity_at"`
}

GitLabProject represents a GitLab project

type ImportProgress

type ImportProgress struct {
	TotalObjects    int
	ImportedObjects int
	CurrentPhase    string
	Errors          []error
}

ImportProgress tracks import progress

type MigrationManager

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

MigrationManager handles migrations from various Git hosting services

func NewMigrationManager

func NewMigrationManager(govcRepo *govc.Repository) *MigrationManager

NewMigrationManager creates a new migration manager

func (*MigrationManager) Cleanup

func (mm *MigrationManager) Cleanup() error

Cleanup removes temporary files

func (*MigrationManager) GetProgress

func (mm *MigrationManager) GetProgress() MigrationProgress

GetProgress returns current migration progress

func (*MigrationManager) Migrate

func (mm *MigrationManager) Migrate(ctx context.Context, opts MigrationOptions) error

Migrate performs migration from specified source

func (*MigrationManager) MigrateBatch

func (mm *MigrationManager) MigrateBatch(ctx context.Context, config BatchMigrationConfig, opts MigrationOptions) error

MigrateBatch performs batch migration with configuration

type MigrationOptions

type MigrationOptions struct {
	Source         string            // github, gitlab, bitbucket
	Organization   string            // Organization/namespace to migrate
	Token          string            // API token for authentication
	IncludeForks   bool              // Include forked repositories
	IncludePrivate bool              // Include private repositories
	Filters        map[string]string // Additional filters
	DryRun         bool              // Don't actually migrate, just show what would be done
}

MigrationOptions contains migration configuration

type MigrationProgress

type MigrationProgress struct {
	CurrentPhase   string
	TotalSteps     int
	CompletedSteps int
	Repositories   int
	CurrentRepo    string
	Errors         []error
	StartTime      time.Time
	EstimatedTime  time.Duration
}

MigrationProgress tracks migration progress

type RestoreOptions

type RestoreOptions struct {
	Target       string            `json:"target"`       // Target repository path
	Overwrite    bool              `json:"overwrite"`    // Overwrite existing repository
	Branch       string            `json:"branch"`       // Restore specific branch
	Since        *time.Time        `json:"since"`        // Restore commits since this time
	Until        *time.Time        `json:"until"`        // Restore commits until this time
	DryRun       bool              `json:"dry_run"`      // Don't actually restore
	Verification bool              `json:"verification"` // Verify backup integrity
	Metadata     map[string]string `json:"metadata"`     // Expected metadata
}

RestoreOptions contains restore configuration

type TagData

type TagData struct {
	Hash    string      `json:"hash"`
	Object  string      `json:"object"`
	Type    string      `json:"type"`
	Tag     string      `json:"tag"`
	Tagger  govc.Author `json:"tagger"`
	Message string      `json:"message"`
}

TagData represents a parsed Git tag object

type TestImportExportIntegration

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

TestImportExportIntegration provides integration testing for import/export functionality

func NewTestIntegration

func NewTestIntegration() (*TestImportExportIntegration, error)

NewTestIntegration creates a new integration test instance

func (*TestImportExportIntegration) Cleanup

func (t *TestImportExportIntegration) Cleanup() error

Cleanup removes all test files and directories

func (*TestImportExportIntegration) CreateTestGitRepo

func (t *TestImportExportIntegration) CreateTestGitRepo() error

CreateTestGitRepo creates a test Git repository with sample content

func (*TestImportExportIntegration) TestExport

func (t *TestImportExportIntegration) TestExport() error

TestExport tests the Git export functionality

func (*TestImportExportIntegration) TestImport

func (t *TestImportExportIntegration) TestImport() error

TestImport tests the Git import functionality

func (*TestImportExportIntegration) TestRoundTrip

func (t *TestImportExportIntegration) TestRoundTrip() error

TestRoundTrip tests import followed by export to ensure consistency

type TreeData

type TreeData struct {
	Hash    string      `json:"hash"`
	Entries []TreeEntry `json:"entries"`
}

TreeData represents a parsed Git tree object

type TreeEntry

type TreeEntry struct {
	Mode string `json:"mode"`
	Name string `json:"name"`
	Hash string `json:"hash"`
}

TreeEntry represents a Git tree entry

Jump to

Keyboard shortcuts

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