filestorekit

package
v0.0.0-...-9e9b37c Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStore

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

func NewCache

func NewCache(cache *cachekit.Cache, underlying Store) *CacheStore

func (*CacheStore) Get

func (s *CacheStore) Get(ctx context.Context, path string) (content []byte, contentType string, err error)

func (*CacheStore) GetURL

func (s *CacheStore) GetURL(path string, expire time.Duration) (string, error)

func (*CacheStore) Put

func (s *CacheStore) Put(ctx context.Context, path string, contentType string, content []byte) error

func (*CacheStore) Remove

func (s *CacheStore) Remove(ctx context.Context, path string) error

type FSStore

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

func NewFS

func NewFS(fs fs.FS) *FSStore

func (*FSStore) Get

func (l *FSStore) Get(ctx context.Context, path string) (content []byte, contentType string, err error)

func (*FSStore) GetURL

func (l *FSStore) GetURL(path string, expire time.Duration) (string, error)

func (*FSStore) Put

func (l *FSStore) Put(ctx context.Context, path string, contentType string, content []byte) error

func (*FSStore) Remove

func (l *FSStore) Remove(ctx context.Context, path string) error

type MediaStore

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

func NewMedia

func NewMedia(cache *cachekit.Cache, underlying Store) *MediaStore

func (*MediaStore) Get

func (s *MediaStore) Get(ctx context.Context, path string) (content []byte, contentType string, err error)

func (*MediaStore) GetFormattedMedia

func (s *MediaStore) GetFormattedMedia(ctx context.Context, path string, format string, gzipContent bool) (content []byte, contentType string, zipped bool, err error)

func (*MediaStore) GetURL

func (s *MediaStore) GetURL(path string, expire time.Duration) (string, error)

func (*MediaStore) Put

func (s *MediaStore) Put(ctx context.Context, path string, contentType string, content []byte) error

func (*MediaStore) Remove

func (s *MediaStore) Remove(ctx context.Context, path string) error

func (*MediaStore) ServeMedia

func (s *MediaStore) ServeMedia(ctx context.Context, path string, format string, w http.ResponseWriter, r *http.Request, allowGzipping bool)

type S3Store

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

func NewS3

func NewS3(region string, s3bucket string, s3prefix string, s3accessKey string, s3secretkey string, endpoint *string) *S3Store

func (*S3Store) Get

func (s *S3Store) Get(ctx context.Context, path string) (content []byte, contentType string, err error)

func (*S3Store) GetURL

func (s *S3Store) GetURL(path string, expire time.Duration) (string, error)

func (*S3Store) Put

func (s *S3Store) Put(ctx context.Context, path string, contentType string, content []byte) error

func (*S3Store) Remove

func (s *S3Store) Remove(ctx context.Context, path string) error

type Store

type Store interface {
	Get(ctx context.Context, path string) (content []byte, contentType string, err error)
	Put(ctx context.Context, path string, contentType string, content []byte) error
	Remove(ctx context.Context, path string) error
	GetURL(path string, expire time.Duration) (string, error)
}

Jump to

Keyboard shortcuts

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