blob

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKeyFormat = errors.New("Blob key is in invalid format")

ErrInvalidKeyFormat is returned when blob key is in invalid format

View Source
var ErrNotFound = errors.New("Blob not found")

ErrNotFound is returned when given blob is not found

Functions

func SanitizeFileName

func SanitizeFileName(fileName string) string

SanitizeFileName replaces invalid characters from given filename

func ValidateKey

func ValidateKey(key string) error

ValidateKey checks if key is is valid format

Types

type Blob

type Blob struct {
	Key         string
	Object      []byte
	Size        int64
	ContentType string
}

Blob is a file persisted somewhere

type Cache

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

Cache provides a Blob backend to the autocert cache.

func NewAutoCert

func NewAutoCert(storage Storage) *Cache

NewAutoCert returns a new AutoCert cache using Blob Storage

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, key string) error

Delete removes a certificate data from the cache under the specified key. If there's no such key in the cache, Delete returns nil.

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) ([]byte, error)

Get returns a certificate data for the specified key. If there's no such key, Get returns ErrCacheMiss.

func (*Cache) Put

func (c *Cache) Put(ctx context.Context, key string, data []byte) error

Put stores the data in the cache under the specified key.

type Storage

type Storage interface {
	SetCurrentTenant(tenant *models.Tenant)
	Get(key string) (*Blob, error)
	Delete(key string) error
	Put(key string, content []byte, contentType string) error
}

Storage is how Fider persists blobs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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