planner

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceTypeFileSystem SourceType = "filesystem"
	SourceTypeS3         SourceType = "s3"

	DestTypeFileSystem DestType = "filesystem"
	DestTypeS3         DestType = "s3"
)

Variables

This section is empty.

Functions

func IsExcluded

func IsExcluded(path string, patterns []string) (bool, error)

Types

type Action

type Action string
const (
	ActionUpload Action = "upload"
	ActionDelete Action = "delete"
	ActionSkip   Action = "skip"
)

type ChecksumData

type ChecksumData struct {
	ItemRef        ItemRef
	SourceChecksum string
	DestChecksum   string
}

type DestType

type DestType string

type Destination

type Destination struct {
	Type     DestType
	Path     string
	Metadata []ItemMetadata
}

type FSToS3Planner

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

func NewFSToS3Planner

func NewFSToS3Planner(client s3client.Client, logger logger.Logger) *FSToS3Planner

func (*FSToS3Planner) Phase2CollectChecksums

func (p *FSToS3Planner) Phase2CollectChecksums(ctx context.Context, items []ItemRef, localBase string, bucket string, prefix string) ([]ChecksumData, error)

func (*FSToS3Planner) Plan

func (p *FSToS3Planner) Plan(ctx context.Context, source Source, dest Destination, opts Options) ([]Item, error)

type Item

type Item struct {
	Action    Action
	LocalPath string
	Bucket    string
	Key       string
	Size      int64
	Reason    string
	Checksum  string
}

func Phase3GeneratePlan

func Phase3GeneratePlan(phase1 Phase1Result, checksums []ChecksumData, localBase string, bucket string, prefix string) []Item

type ItemMetadata

type ItemMetadata struct {
	Path     string
	Size     int64
	ModTime  time.Time
	Checksum string
}

type ItemRef

type ItemRef struct {
	Path string
	Size int64
}

type Options

type Options struct {
	DeleteEnabled bool
	Excludes      []string
	Logger        logger.Logger
}

type Phase1Result

type Phase1Result struct {
	NewItems     []ItemRef
	DeletedItems []ItemRef
	SizeMismatch []ItemRef
	NeedChecksum []ItemRef
	Identical    []ItemRef
}

func Phase1Compare

func Phase1Compare(source []ItemMetadata, dest []ItemMetadata, deleteEnabled bool) Phase1Result

type Planner

type Planner interface {
	Plan(ctx context.Context, source Source, dest Destination, opts Options) ([]Item, error)
}

type Source

type Source struct {
	Type     SourceType
	Path     string
	Metadata []ItemMetadata
}

type SourceType

type SourceType string

Jump to

Keyboard shortcuts

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