gcsremote

package
v1.101.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// Path to GCP credentials file.
	//
	// Default credentials are used if empty.
	CredsFilePath string

	// GCS bucket to use.
	Bucket string

	// Directory in the bucket to write to.
	Dir string
	// contains filtered or unexported fields
}

FS represents filesystem for backups in GCS.

Init must be called before calling other FS methods.

func (*FS) CopyPart

func (fs *FS) CopyPart(srcFS common.OriginFS, p common.Part) error

CopyPart copies p from srcFS to fs.

func (*FS) CreateFile added in v1.32.1

func (fs *FS) CreateFile(filePath string, data []byte) error

CreateFile creates filePath at fs and puts data into it.

The file is overwritten if it exists.

func (*FS) DeleteFile added in v1.32.1

func (fs *FS) DeleteFile(filePath string) error

DeleteFile deletes filePath at fs if it exists.

The function does nothing if the filePath doesn't exists.

func (*FS) DeletePart

func (fs *FS) DeletePart(p common.Part) error

DeletePart deletes part p from fs.

func (*FS) DownloadPart

func (fs *FS) DownloadPart(p common.Part, w io.Writer) error

DownloadPart downloads part p from fs to w.

func (*FS) HasFile added in v1.32.1

func (fs *FS) HasFile(filePath string) (bool, error)

HasFile returns ture if filePath exists at fs.

func (*FS) Init

func (fs *FS) Init() error

Init initializes fs.

The returned fs must be stopped when no long needed with MustStop call.

func (*FS) ListParts

func (fs *FS) ListParts() ([]common.Part, error)

ListParts returns all the parts for fs.

func (*FS) MustStop added in v1.44.0

func (fs *FS) MustStop()

MustStop stops fs.

func (*FS) ReadFile added in v1.94.0

func (fs *FS) ReadFile(filePath string) ([]byte, error)

ReadFile returns the content of filePath at fs.

func (*FS) RemoveEmptyDirs

func (fs *FS) RemoveEmptyDirs() error

RemoveEmptyDirs recursively removes empty dirs in fs.

func (*FS) String

func (fs *FS) String() string

String returns human-readable description for fs.

func (*FS) UploadPart

func (fs *FS) UploadPart(p common.Part, r io.Reader) error

UploadPart uploads part p from r to fs.

Jump to

Keyboard shortcuts

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