imagestore

package
v0.0.0-...-fedf337 Latest Latest
Warning

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

Go to latest
Published: May 31, 2017 License: MIT Imports: 19 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory(conf *config.Configuration) *Factory

func (*Factory) NewGCSImageStore

func (this *Factory) NewGCSImageStore(conf map[string]string) ImageStore

func (*Factory) NewHashGenerator

func (this *Factory) NewHashGenerator(store ImageStore) *HashGenerator

func (*Factory) NewImageStores

func (this *Factory) NewImageStores() ImageStore

func (*Factory) NewLocalImageStore

func (this *Factory) NewLocalImageStore(conf map[string]string) ImageStore

func (*Factory) NewS3ImageStore

func (this *Factory) NewS3ImageStore(conf map[string]string) ImageStore

func (*Factory) NewStoreObject

func (this *Factory) NewStoreObject(id string, mime string, size string) *StoreObject

type GCSImageStore

type GCSImageStore struct {
	// contains filtered or unexported fields
}

func NewGCSImageStore

func NewGCSImageStore(ctx context.Context, bucket string, root string, mapper *NamePathMapper) *GCSImageStore

func (*GCSImageStore) Exists

func (this *GCSImageStore) Exists(obj *StoreObject) (bool, error)

func (*GCSImageStore) Get

func (this *GCSImageStore) Get(obj *StoreObject) (io.ReadCloser, error)

func (*GCSImageStore) Save

func (this *GCSImageStore) Save(src string, obj *StoreObject) (*StoreObject, error)

func (*GCSImageStore) String

func (this *GCSImageStore) String() string

type HashGenerator

type HashGenerator struct {
	// contains filtered or unexported fields
}

Provides a continuous stream of random image "hashes" of a fixed length that is unique (does not exist in the store).

func (*HashGenerator) Get

func (this *HashGenerator) Get() string

type ImageStore

type ImageStore interface {
	Save(src string, obj *StoreObject) (*StoreObject, error)
	Exists(obj *StoreObject) (bool, error)
	Get(obj *StoreObject) (io.ReadCloser, error)
	String() string
}

type InMemoryImageStore

type InMemoryImageStore struct {
	// contains filtered or unexported fields
}

func NewInMemoryImageStore

func NewInMemoryImageStore() *InMemoryImageStore

func (*InMemoryImageStore) Exists

func (this *InMemoryImageStore) Exists(obj *StoreObject) (bool, error)

func (*InMemoryImageStore) Get

func (this *InMemoryImageStore) Get(obj *StoreObject) (io.ReadCloser, error)

func (*InMemoryImageStore) Save

func (this *InMemoryImageStore) Save(src string, obj *StoreObject) (*StoreObject, error)

func (*InMemoryImageStore) String

func (this *InMemoryImageStore) String() string

type LocalImageStore

type LocalImageStore struct {
	// contains filtered or unexported fields
}

A LocalImageStore stores images on the local disk.

func NewLocalImageStore

func NewLocalImageStore(root string, mapper *NamePathMapper) *LocalImageStore

func (*LocalImageStore) Exists

func (this *LocalImageStore) Exists(obj *StoreObject) (bool, error)

func (*LocalImageStore) Get

func (this *LocalImageStore) Get(obj *StoreObject) (io.ReadCloser, error)

func (*LocalImageStore) Save

func (this *LocalImageStore) Save(src string, obj *StoreObject) (*StoreObject, error)

func (*LocalImageStore) String

func (this *LocalImageStore) String() string

type MultiImageStore

type MultiImageStore []ImageStore

func (MultiImageStore) Exists

func (this MultiImageStore) Exists(obj *StoreObject) (bool, error)

func (MultiImageStore) Get

func (this MultiImageStore) Get(obj *StoreObject) (io.ReadCloser, error)

func (MultiImageStore) Save

func (this MultiImageStore) Save(src string, obj *StoreObject) (*StoreObject, error)

func (MultiImageStore) String

func (this MultiImageStore) String() string

type NamePathMapper

type NamePathMapper struct {
	// contains filtered or unexported fields
}

func NewNamePathMapper

func NewNamePathMapper(expr string, mapping string) *NamePathMapper

type S3ImageStore

type S3ImageStore struct {
	// contains filtered or unexported fields
}

func NewS3ImageStore

func NewS3ImageStore(bucket string, root string, client *s3.S3, mapper *NamePathMapper) *S3ImageStore

func (*S3ImageStore) Exists

func (this *S3ImageStore) Exists(obj *StoreObject) (bool, error)

func (*S3ImageStore) Get

func (this *S3ImageStore) Get(obj *StoreObject) (io.ReadCloser, error)

func (*S3ImageStore) Save

func (this *S3ImageStore) Save(src string, obj *StoreObject) (*StoreObject, error)

func (*S3ImageStore) String

func (this *S3ImageStore) String() string

type StorableObject

type StorableObject interface {
	GetPath() string
}

type StoreObject

type StoreObject struct {
	Id       string // Unique identifier
	MimeType string // i.e. image/jpg
	Size     string // i.e. thumb
	Url      string // if publicly available
}

func (*StoreObject) Store

func (this *StoreObject) Store(s StorableObject, store ImageStore) error

Jump to

Keyboard shortcuts

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