s3remote

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

func StringToS3StorageClass added in v1.91.0

func StringToS3StorageClass(sc string) s3types.StorageClass

StringToS3StorageClass converts string types to AWS S3 StorageClass type for value comparison

Types

type FS

type FS struct {
	// Path to S3 credentials file.
	CredsFilePath string

	// Path to S3 configs file.
	ConfigFilePath string

	// S3 bucket to use.
	Bucket string

	// Directory in the bucket to write to.
	Dir string

	// Set for using S3-compatible endpoint such as MinIO etc.
	CustomEndpoint string

	// Force to use path style for s3, true by default.
	S3ForcePathStyle bool

	// Object Storage Class: https://aws.amazon.com/s3/storage-classes/
	StorageClass s3types.StorageClass

	// The name of S3 config profile to use.
	ProfileName string
	// contains filtered or unexported fields
}

FS represents filesystem for backups in S3.

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 already exists.

func (*FS) DeleteFile added in v1.32.1

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

DeleteFile deletes filePath from fs if it exists.

The function does nothing if the file doesn't exist.

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 true 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