backend

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Azure type of the corresponding backend represented as string constant.
	Azure = "azure"
	// FileSystem type of the corresponding backend represented as string constant.
	FileSystem = "filesystem"
	// GCS type of the corresponding backend represented as string constant.
	GCS = "gcs"
	// S3 type of the corresponding backend represented as string constant.
	S3 = "s3"
	// SFTP type of the corresponding backend represented as string constant.
	SFTP = "sftp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Get writes downloaded content to the given writer.
	Get(ctx context.Context, p string, w io.Writer) error

	// Put uploads contents of the given reader.
	Put(ctx context.Context, p string, r io.Reader) error

	// Exists checks if path already exists.
	Exists(ctx context.Context, p string) (bool, error)
}

Backend implements operations for caching files.

func FromConfig

func FromConfig(l log.Logger, backedType string, cfg Config) (Backend, error)

FromConfig creates new Backend by initializing using given configuration.

type Config

type Config struct {
	Debug bool

	S3         s3.Config
	FileSystem filesystem.Config
	SFTP       sftp.Config
	Azure      azure.Config
	GCS        gcs.Config
}

Config configures behavior of Backend.

type FileEntry

type FileEntry struct {
	Path         string
	Size         int64
	LastModified time.Time
}

FileEntry defines a single cache item.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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