Documentation
¶
Overview ¶
Package mirror provides the core interfaces and types for artifact mirroring.
Index ¶
- func ProcessMirrorResults(logger *logrus.Logger, results <-chan MirrorResult) error
- func SetupDestination(logger *logrus.Logger, config *config.Config) (core.Destination, error)
- func SetupSource(logger *logrus.Logger, config *config.Config) (core.Source, error)
- type ChecksumValidatingReader
- type DefaultMirror
- func (m *DefaultMirror) AddDestination(name string, destination core.Destination) error
- func (m *DefaultMirror) AddSource(name string, source core.Source) error
- func (m *DefaultMirror) GetDestination(name string) (core.Destination, error)
- func (m *DefaultMirror) GetSource(name string) (core.Source, error)
- func (m *DefaultMirror) Mirror(ctx context.Context, artifacts []*core.Artifact, opts *core.MirrorOptions) <-chan MirrorResult
- func (m *DefaultMirror) ProcessMirrorResults(logger *logrus.Logger, results <-chan MirrorResult) error
- func (m *DefaultMirror) SetupDestination(logger *logrus.Logger, config *config.Config) (core.Destination, error)
- func (m *DefaultMirror) SetupSource(logger *logrus.Logger, config *config.Config) (core.Source, error)
- type Mirror
- type MirrorResult
- type ProgressTracker
- type UploadWorkerParams
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProcessMirrorResults ¶
func ProcessMirrorResults(logger *logrus.Logger, results <-chan MirrorResult) error
ProcessMirrorResults processes the results from the mirror operation.
func SetupDestination ¶
SetupDestination creates and configures a destination based on the provided configuration.
func SetupSource ¶
SetupSource creates and configures a mirroring source based on the provided configuration. It currently supports a GitHub source when the source type is "github" and returns an error if an unsupported source type is specified or if the created source fails validation.
Types ¶
type ChecksumValidatingReader ¶ added in v0.5.6
type ChecksumValidatingReader struct {
// contains filtered or unexported fields
}
ChecksumValidatingReader wraps an io.ReadCloser and validates the SHA256 checksum of the read content against an expected value.
func NewChecksumValidatingReader ¶ added in v0.5.6
func NewChecksumValidatingReader(reader io.ReadCloser, expectedChecksum string) *ChecksumValidatingReader
NewChecksumValidatingReader creates a new ChecksumValidatingReader.
func (*ChecksumValidatingReader) Close ¶ added in v0.5.6
func (r *ChecksumValidatingReader) Close() error
Close closes the underlying reader.
type DefaultMirror ¶
type DefaultMirror struct {
// contains filtered or unexported fields
}
DefaultMirror implements the Mirror interface.
func NewDefaultMirror ¶
func NewDefaultMirror(logger *logrus.Logger) *DefaultMirror
NewDefaultMirror creates a new DefaultMirror instance.
func (*DefaultMirror) AddDestination ¶
func (m *DefaultMirror) AddDestination(name string, destination core.Destination) error
AddDestination adds a new destination to the mirror.
func (*DefaultMirror) AddSource ¶
func (m *DefaultMirror) AddSource(name string, source core.Source) error
AddSource adds a new source to the mirror.
func (*DefaultMirror) GetDestination ¶
func (m *DefaultMirror) GetDestination(name string) (core.Destination, error)
GetDestination retrieves a destination by name.
func (*DefaultMirror) GetSource ¶
func (m *DefaultMirror) GetSource(name string) (core.Source, error)
GetSource retrieves a source by name.
func (*DefaultMirror) Mirror ¶
func (m *DefaultMirror) Mirror( ctx context.Context, artifacts []*core.Artifact, opts *core.MirrorOptions, ) <-chan MirrorResult
Mirror copies artifacts from sources to destinations.
func (*DefaultMirror) ProcessMirrorResults ¶
func (m *DefaultMirror) ProcessMirrorResults(logger *logrus.Logger, results <-chan MirrorResult) error
ProcessMirrorResults processes the results from the mirror operation.
func (*DefaultMirror) SetupDestination ¶
func (m *DefaultMirror) SetupDestination(logger *logrus.Logger, config *config.Config) (core.Destination, error)
SetupDestination creates and configures a destination based on the provided configuration.
func (*DefaultMirror) SetupSource ¶
func (m *DefaultMirror) SetupSource(logger *logrus.Logger, config *config.Config) (core.Source, error)
SetupSource creates and configures a source based on the provided configuration.
type Mirror ¶
type Mirror interface {
// Mirror copies artifacts from a source to a destination
Mirror(ctx context.Context, artifacts []*core.Artifact, opts *core.MirrorOptions) <-chan MirrorResult
// AddSource adds a new source to the mirror
AddSource(name string, source core.Source) error
// AddDestination adds a new destination to the mirror
AddDestination(name string, destination core.Destination) error
// GetSource retrieves a source by name
GetSource(name string) (core.Source, error)
// GetDestination retrieves a destination by name
GetDestination(name string) (core.Destination, error)
}
Mirror represents the core mirroring functionality.
type MirrorResult ¶
type MirrorResult struct {
// Artifact is the original artifact that was mirrored
Artifact *core.Artifact
// DestinationPath is where the artifact was mirrored to
DestinationPath string
// Error contains any error that occurred during mirroring
// If nil, the operation was successful
Error error
}
MirrorResult contains the result of a mirror operation.
type ProgressTracker ¶
type ProgressTracker interface {
// Start initializes the progress tracking
Start(total int64)
// Update updates the current progress
Update(current int64)
// Complete marks the operation as complete
Complete()
}
ProgressTracker provides progress tracking for mirror operations.
type UploadWorkerParams ¶ added in v0.5.6
type UploadWorkerParams struct {
// contains filtered or unexported fields
}
UploadWorkerParams holds parameters for the upload worker.
type Validator ¶
type Validator interface {
// ValidateArtifact checks if an artifact is valid
ValidateArtifact(artifact *core.Artifact) error
// ValidateChecksum verifies the checksum of an artifact
ValidateChecksum(artifact *core.Artifact, content io.Reader) error
}
Validator provides validation functionality for artifacts.