storage

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Errorf

func Errorf(cause error, code ErrorCode, format string, a ...interface{}) error

func IsAuthError

func IsAuthError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsTimeoutError

func IsTimeoutError(err error) bool

func RegisterFactory

func RegisterFactory(scheme string, factory BlobStoreFactory)

func SupportedSchemes

func SupportedSchemes() []string

Types

type BlobStore

type BlobStore interface {
	Put(ctx context.Context, key string, sink Sink, opts PutOptions) error
	Get(ctx context.Context, key string, source Source, opts GetOptions) error
	Delete(ctx context.Context, key string, opts DeleteOptions) error
}

func NewBlobStore

func NewBlobStore(u url.URL) (BlobStore, error)

type BlobStoreFactory

type BlobStoreFactory func(url.URL) (BlobStore, error)

type DeleteOptions

type DeleteOptions struct {
}

type ErrorCode

type ErrorCode string
const (
	AuthError     ErrorCode = "AuthError"
	NotFoundError ErrorCode = "NotFoundError"
	TimeoutError  ErrorCode = "TimeoutError"
	UnknownError  ErrorCode = "UnknownError"
)

type GetOptions

type GetOptions struct {
	// Offset is the byte offset to begin at, it may be negative
	// to specify an offset from the end of the blob.
	Offset int64

	// Length is the maximum number of bytes to return, if <= 0
	// then all bytes after Offset are returned. The Length must
	// be <= 0 if Offset is negative due to the limitations of
	// HTTP range requests.
	Length int64
}

type Meta

type Meta struct {
	// ContentType of the blob
	ContentType string
	// Offset within the blob that the read begins
	Offset int64
	// Size is the total size of the blob
	Size int64
}

type PutOptions

type PutOptions struct {
	// ContentType of the blob
	ContentType string
}

type Sink

type Sink func(io.Writer) error

type Source

type Source func(*Meta, io.Reader) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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