backup

package
v14.0.0-rc44 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkipped = errors.New("repository skipped")

ErrSkipped means the repository was skipped because there was nothing to backup

Functions

This section is empty.

Types

type CreatePipeline

type CreatePipeline interface {
	Create(context.Context, *CreateRequest)
	Done() error
}

CreatePipeline is a pipeline that only handles creating backups

type CreateRequest

type CreateRequest struct {
	Server     storage.ServerInfo
	Repository *gitalypb.Repository
}

CreateRequest is the request to create a backup

type Filesystem

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

Filesystem strategy for creating and restoring backups

func NewFilesystem

func NewFilesystem(path string) *Filesystem

NewFilesystem creates a new Filesystem strategy

func (*Filesystem) Create

func (fs *Filesystem) Create(ctx context.Context, req *CreateRequest) error

Create creates a repository backup on a local filesystem

func (*Filesystem) Restore

func (fs *Filesystem) Restore(ctx context.Context, req *RestoreRequest) error

Restore restores a repository from a backup on a local filesystem

type ParallelCreatePipeline

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

ParallelCreatePipeline is a pipeline that creates backups in parallel

func NewParallelCreatePipeline

func NewParallelCreatePipeline(next CreatePipeline, n int) *ParallelCreatePipeline

NewParallelCreatePipeline creates a new ParallelCreatePipeline where `next` is the pipeline called to create the backups and `n` is the number of parallel backups that will run.

func (*ParallelCreatePipeline) Create

func (p *ParallelCreatePipeline) Create(ctx context.Context, req *CreateRequest)

Create queues a call to `next.Create` which will be run in parallel

func (*ParallelCreatePipeline) Done

func (p *ParallelCreatePipeline) Done() error

Done waits for any in progress calls to `Create` to complete then reports any accumulated errors

type Pipeline

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

Pipeline handles a series of requests to create/restore backups. Pipeline encapsulates error handling for the caller.

func NewPipeline

func NewPipeline(log logrus.FieldLogger, strategy Strategy) *Pipeline

NewPipeline creates a new pipeline

func (*Pipeline) Create

func (p *Pipeline) Create(ctx context.Context, req *CreateRequest)

Create requests that a repository backup be created

func (*Pipeline) Done

func (p *Pipeline) Done() error

Done indicates that the pipeline is complete and returns any accumulated errors

func (*Pipeline) Restore

func (p *Pipeline) Restore(ctx context.Context, req *RestoreRequest)

Restore requests that a repository be restored from backup

type RestoreRequest

type RestoreRequest struct {
	Server       storage.ServerInfo
	Repository   *gitalypb.Repository
	AlwaysCreate bool
}

RestoreRequest is the request to restore from a backup

type Strategy

type Strategy interface {
	Create(context.Context, *CreateRequest) error
	Restore(context.Context, *RestoreRequest) error
}

Strategy used to create/restore backups

Jump to

Keyboard shortcuts

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