storageutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package storageutil implements storage utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(
	ctx context.Context,
	from storage.ReadBucket,
	to storage.Bucket,
	prefix string,
	options ...storagepath.TransformerOption,
) (int, error)

Copy copies the bucket at from to the bucket at to for the given prefix.

Copies done concurrently.

Paths from the source bucket will be transformed before being added to the destination bucket. Returns the number of files copied.

func CopyPaths

func CopyPaths(
	ctx context.Context,
	from storage.ReadBucket,
	to storage.Bucket,
	paths ...string,
) (int, error)

CopyPaths copies the paths from the bucket at from to the bucket at to, if they exist.

Paths will be normalized within this function. Copies done concurrently.

Returns the number of files copied.

func ReadPath

func ReadPath(ctx context.Context, bucket storage.ReadBucket, path string) (_ []byte, retErr error)

ReadPath is analogous to ioutil.ReadFile.

Returns an error that fufills storage.IsNotExist if the path does not exist.

func Tar

func Tar(
	ctx context.Context,
	writer io.Writer,
	bucket storage.Bucket,
	prefix string,
	options ...storagepath.TransformerOption,
) error

Tar tars the given bucket to the writer.

Only regular files are added to the writer. All files are written as 0644.

Paths from the bucket will be transformed before adding to the writer.

func Targz

func Targz(
	ctx context.Context,
	writer io.Writer,
	bucket storage.Bucket,
	prefix string,
	options ...storagepath.TransformerOption,
) error

Targz tars and gzips the given bucket to the writer.

Only regular files are added to the writer. All files are written as 0644.

Paths from the bucket will be transformed before adding to the writer.

func Untar

func Untar(
	ctx context.Context,
	reader io.Reader,
	bucket storage.Bucket,
	options ...storagepath.TransformerOption,
) error

Untar untars the given tar archive from the reader into the bucket.

Only regular files are added to the bucket.

Paths from the tar archive will be transformed before adding to the bucket.

func Untargz

func Untargz(
	ctx context.Context,
	reader io.Reader,
	bucket storage.Bucket,
	options ...storagepath.TransformerOption,
) error

Untargz untars the given targz archive from the reader into the bucket.

Only regular files are added to the bucket.

Paths from the targz archive will be transformed before adding to the bucket.

Types

This section is empty.

Jump to

Keyboard shortcuts

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