s3

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package s3 implements a file store on Amazon S3-compatible storage.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchBucket = errors.New("no such bucket")

Functions

This section is empty.

Types

type S3FS

type S3FS struct {
	*minio.Client
	// contains filtered or unexported fields
}

func New

func New(endpoint string, tls bool, id, secret, bucket, location string) (S3FS, error)

New connects to S3-compatible storage and returns a file store using it.

If the specified bucket doesn't exist, ErrNoSuchBucket is returned.

func (S3FS) Delete

func (fs S3FS) Delete(ctx context.Context, id uuid.UUID) error

func (S3FS) Get

func (fs S3FS) Get(ctx context.Context, id uuid.UUID) (fstore.File, error)

func (S3FS) Post

func (fs S3FS) Post(ctx context.Context, name, mediaType string, data io.Reader) (uuid.UUID, error)

Post creates a new S3 object with the string representation of the id as name. For potentially greater efficiency of the upload, implement

Size() int64

on data.

Notes

Bugs

  • getting the name relies on the capitalization of metadata fields (“Name”)

Jump to

Keyboard shortcuts

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