Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyNotFound = errors.New("key not found") ErrImageNotFound = errors.New("image not found") )
Functions ¶
This section is empty.
Types ¶
type DataStore ¶
type DataStore interface { Get(key string) ([]byte, error) Set(key string, value []byte) error Delete(key string) error // GenerateId generates a unique id for the store GenerateId() (string, error) }
DataStore is an interface for storing and retrieving data from a key value store
type DiskDataStore ¶
type DiskDataStore struct {
// contains filtered or unexported fields
}
func NewDiskDataStore ¶
func NewDiskDataStore(filePath string) (*DiskDataStore, error)
func (*DiskDataStore) Delete ¶
func (d *DiskDataStore) Delete(key string) error
func (*DiskDataStore) GenerateId ¶
func (d *DiskDataStore) GenerateId() (string, error)
type DiskImageStore ¶
type DiskImageStore struct {
// contains filtered or unexported fields
}
func NewDiskImageStore ¶
func NewDiskImageStore(rootPath string) *DiskImageStore
NewDiskImageStore creates a new DiskImageStore that stores images in the given rootPath. If you want to use this to actually serve files, this should be a path you expose as part of your server
type ImageStore ¶
type ImageStore interface { // Get an image from the store, returning the URL to the image, but not the image itself. This // allows an implementation to do things like generate a token to a CDN Get(container string, id string) (*url.URL, error) // Set an image to the store, returning the URL to the image. This allows an implementation // to do things like generating a token to a CDN Set(container string, id string, expected_length uint, value io.ReadCloser) (*url.URL, error) Delete(container string, id string) error }
Click to show internal directories.
Click to hide internal directories.