backend

package
v0.0.0-...-b15389a Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conditions

type Conditions struct {
	IfMatch           string
	IfModifiedSince   time.Time
	IfNoneMatch       string
	IfUnmodifiedSince time.Time
}

func ConditionsFromRequest

func ConditionsFromRequest(req *http.Request) *Conditions

type Entry

type Entry struct {
	Name         string     `json:"name"`
	Type         EntryType  `json:"type"`
	Size         int64      `json:"size,omitempty"`
	ETag         string     `json:"eTag,omitempty"`
	LastModified *time.Time `json:"lastModified,omitempty"`
}

type EntryType

type EntryType string
const (
	TypeFile      EntryType = "file"
	TypeDirectory EntryType = "directory"
)

type ObjectMeta

type ObjectMeta struct {
	ContentType   string            `json:"contentType,omitempty"`
	ContentLength *int64            `json:"contentLength"`
	ETag          string            `json:"eTag,omitempty"`
	Expires       time.Time         `json:"expires,omitempty"`
	LastModified  time.Time         `json:"lastModified,omitempty"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	VersionID     string            `json:"versionID,omitempty"`
}

ObjectMeta is the metadata we store about an S3 object.

func ObjectMetaFromObject

func ObjectMetaFromObject(obj *s3.GetObjectOutput) *ObjectMeta

func ObjectMetaFromObjectHead

func ObjectMetaFromObjectHead(head *s3.HeadObjectOutput) *ObjectMeta

func (*ObjectMeta) WriteHeaders

func (m *ObjectMeta) WriteHeaders(h http.Header)

type Storage

type Storage struct {
	Bucket string
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(src *s3.S3, bucket string) *Storage

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, path string, cond *Conditions) (*ObjectMeta, io.ReadCloser, error)

func (*Storage) Head

func (s *Storage) Head(ctx context.Context, path string, cond *Conditions) (*ObjectMeta, error)

func (*Storage) List

func (s *Storage) List(ctx context.Context, path string) ([]*Entry, error)

Jump to

Keyboard shortcuts

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