export

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartAction  = "export:start"
	CopyAction   = "export:copy"
	DeleteAction = "export:delete"
	TouchAction  = "export:touch"
	DoneAction   = "export:done"
)

Variables

View Source
var (
	ErrExportInProgress = errors.New("export currently in progress")
	ErrNothingToExport  = errors.New("nothing to export")
)
View Source
var (
	ErrConflictingRefs = errors.New("conflicting references")
	ErrWrongStatus     = errors.New("incorrect status")
)
View Source
var (
	ErrMissingColumns = errors.New("missing columns in differences result")
	ErrConflict       = errors.New("cannot generate task for conflict in diff")
)

Functions

func ExportBranchDone added in v0.16.0

func ExportBranchDone(parade parade.Parade, cataloger catalog.Cataloger, status catalog.CatalogBranchExportStatus, statusMsg *string, repo, branch, commitRef string) error

ExportBranchDone ends the export branch process by changing the status

func ExportBranchRepair added in v0.17.0

func ExportBranchRepair(cataloger catalog.Cataloger, repo, branch string) error

ExportBranchRepair changes state from Failed To Repair and starts a new export. It fails if the current state is not ExportStatusFailed.

func ExportBranchStart added in v0.16.0

func ExportBranchStart(parade parade.Parade, cataloger catalog.Cataloger, repo, branch string) (string, error)

ExportBranchStart inserts a start task on branch, sets branch export state to pending. It returns ErrExportInProgress if an export is already in progress.

func GetStartTasks added in v0.16.0

func GetStartTasks(repo, branch, fromCommitRef, toCommitRef, exportID string, config catalog.ExportConfiguration) ([]parade.TaskData, error)

func PathToPointer added in v0.15.0

func PathToPointer(path string) (block.ObjectPointer, error)

Types

type CopyData

type CopyData struct {
	From string `json:"from"`
	To   string `json:"to"`
	ETag string `json:"etag"` // Empty for now :-(
}

type DeleteData

type DeleteData struct {
	File string `json:"file"`
}

type DirMatchCache

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

func NewDirMatchCache

func NewDirMatchCache(pred func(path string) bool) *DirMatchCache

func (*DirMatchCache) Lookup

func (dmc *DirMatchCache) Lookup(filename string) (string, bool)

type FinishData added in v0.16.0

type FinishData struct {
	Repo       string `json:"repo"`
	Branch     string `json:"branch"`
	CommitRef  string `json:"commitRef"`
	StatusPath string `json:"status_path"`
}

type Handler added in v0.15.0

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

func NewHandler added in v0.15.0

func NewHandler(adapter block.Adapter, cataloger catalog.Cataloger, parade parade.Parade) *Handler

func (*Handler) Actions added in v0.15.0

func (h *Handler) Actions() []string

func (*Handler) ActorID added in v0.15.0

func (h *Handler) ActorID() parade.ActorID

func (*Handler) Handle added in v0.15.0

func (h *Handler) Handle(action string, body *string, signalledErrors int) parade.ActorResult

type StartData added in v0.16.0

type StartData struct {
	Repo          string `json:"repo"`
	Branch        string `json:"branch"`
	FromCommitRef string `json:"from"`
	ToCommitRef   string `json:"to"`
	ExportID      string `json:"export_id"`
	ExportConfig  catalog.ExportConfiguration
}

type SuccessData

type SuccessData struct {
	File string `json:"file"`
}

type SuccessTasksTreeGenerator

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

SuccessTasksTreeGenerator accumulates success tasks during task generator. It is exported (only) for testing.

func NewSuccessTasksTreeGenerator

func NewSuccessTasksTreeGenerator(exportID string, generateSuccessFor func(path string) bool, makeDestination func(string) string, finishBody *string) SuccessTasksTreeGenerator

func (*SuccessTasksTreeGenerator) AddFor

func (s *SuccessTasksTreeGenerator) AddFor(path string) (parade.TaskID, error)

AddFor adds a dependency task for path (there will always be exactly one, either to create a success file after path, or to finish everything), and returns its task ID for the caller to signal when done.

func (*SuccessTasksTreeGenerator) GenerateTasksTo

func (s *SuccessTasksTreeGenerator) GenerateTasksTo(tasks []parade.TaskData) []parade.TaskData

GenerateTasksTo generates and appends all success tasks and the finished task to tasks, returning a new tasks slice.

type TaskBody added in v0.15.0

type TaskBody struct {
	DestinationNamespace string
	DestinationID        string
	SourceNamespace      string
	SourceID             string
}

type TaskIDGenerator added in v0.16.0

type TaskIDGenerator string

taskIdGenerator generates IDs for export tasks based on its exportID.

func (TaskIDGenerator) CopyTaskID added in v0.16.0

func (exportID TaskIDGenerator) CopyTaskID(path string) parade.TaskID

func (TaskIDGenerator) DeleteTaskID added in v0.16.0

func (exportID TaskIDGenerator) DeleteTaskID(path string) parade.TaskID

type TasksGenerator added in v0.16.0

type TasksGenerator struct {
	ExportID           string
	DstPrefix          string
	GenerateSuccessFor func(path string) bool
	NumTries           int
	// contains filtered or unexported fields
}

TasksGenerator generates tasks from diffs iteratively.

func NewTasksGenerator added in v0.16.0

func NewTasksGenerator(exportID string, dstPrefix string, generateSuccessFor func(path string) bool, finishBody *string, storageNamespace string) *TasksGenerator

NewTasksGenerator returns a generator that exports tasks from diffs to file operations under dstPrefix. It generates success files for files in directories matched by "generateSuccessFor".

func (*TasksGenerator) Add added in v0.16.0

Add translates diffs into many tasks and remembers "generate success" tasks for Finish. It returns some tasks that can already be added.

func (*TasksGenerator) Finish added in v0.16.0

func (e *TasksGenerator) Finish() ([]parade.TaskData, error)

Finish ends tasks generation, releasing any tasks for success and finish.

Jump to

Keyboard shortcuts

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