store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when an object in the store could not be found.

Functions

func GetObject

func GetObject(ctx context.Context, s Store, bucket string, key string) ([]byte, error)

GetObject is a wrapper around the store Get method. It returns the contents of an object as a byte slice.

Types

type Range

type Range struct {
	From uint64
	To   uint64
}

Range specifies a byte range, inclusive at each end

type Store

type Store interface {
	Put(ctx context.Context, bucket string, key string, r io.Reader) error

	Get(ctx context.Context, bucket string, key string) (io.ReadCloser, error)

	// Copy makes a copy of a file. Returns an error if the file does not exist.
	Copy(bucket string, from string, to string) error

	// Delete deletes a file. Returns an error if the file does not exist.
	Delete(bucket string, key string) error

	// PresignGetURL generates a URL to download an object.
	PresignGetURL(bucket string, key string, expires time.Duration, contentRange *Range) (string, error)
}

Store is an interface to an object store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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