Documentation ¶
Index ¶
- Variables
- type DataStore
- type Image
- type ImageCache
- func (c *ImageCache) CreateImage(i Image) error
- func (c *ImageCache) DeleteImage(ID string) error
- func (c *ImageCache) GetAllImages() ([]Image, error)
- func (c *ImageCache) GetImage(ID string) (Image, error)
- func (c *ImageCache) Init(rawDs RawDataStore, metaDs MetaDataStore) error
- func (c *ImageCache) UpdateImage(i Image) error
- func (c *ImageCache) UploadImage(ID string, body io.Reader) error
- type MetaDataStore
- type Noop
- type Posix
- type RawDataStore
- type State
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoImage is returned when an image is not found. ErrNoImage = errors.New("Image not found") // ErrImageSaving is returned when an image is being uploaded. ErrImageSaving = errors.New("Image being uploaded") )
Functions ¶
This section is empty.
Types ¶
type DataStore ¶
type DataStore interface { Init(RawDataStore, MetaDataStore) error CreateImage(Image) error GetAllImages() ([]Image, error) GetImage(string) (Image, error) UpdateImage(Image) error DeleteImage(string) error UploadImage(string, io.Reader) error }
DataStore is the image data storage interface.
type Image ¶
type Image struct { ID string State State TenantID string Name string CreateTime time.Time Type Type }
Image contains the information that ciao will store about the image
func (Image) Visibility ¶
func (i Image) Visibility() image.Visibility
Visibility returns the image visibility
type ImageCache ¶
type ImageCache struct {
// contains filtered or unexported fields
}
ImageCache is an image metadata cache.
func (*ImageCache) CreateImage ¶
func (c *ImageCache) CreateImage(i Image) error
CreateImage will add an image to the datastore.
func (*ImageCache) DeleteImage ¶
func (c *ImageCache) DeleteImage(ID string) error
DeleteImage will delete an existing image.
func (*ImageCache) GetAllImages ¶
func (c *ImageCache) GetAllImages() ([]Image, error)
GetAllImages gets returns all the known images.
func (*ImageCache) GetImage ¶
func (c *ImageCache) GetImage(ID string) (Image, error)
GetImage returns the image specified by the ID string.
func (*ImageCache) Init ¶
func (c *ImageCache) Init(rawDs RawDataStore, metaDs MetaDataStore) error
Init initializes the datastore struct and must be called before anything.
func (*ImageCache) UpdateImage ¶
func (c *ImageCache) UpdateImage(i Image) error
UpdateImage will modify an existing image.
func (*ImageCache) UploadImage ¶
func (c *ImageCache) UploadImage(ID string, body io.Reader) error
UploadImage will read an image, save it and update the image cache.
type MetaDataStore ¶
type MetaDataStore interface { Write(Image) error Delete(ID string) error GetAll() ([]Image, error) }
MetaDataStore is the metadata storing interface that's used by image cache implementation.
type Noop ¶
type Noop struct { }
Noop is a Datastore implementation that does nothing. Use it only for development and testing purposes, data will not be persistent with the Noop Datastore interface.
type Posix ¶
type Posix struct {
MountPoint string
}
Posix implements the DataStore interface for posix filesystems
type RawDataStore ¶
type RawDataStore interface { Write(ID string, body io.Reader) (int64, error) Delete(ID string) error }
RawDataStore is the raw data storage interface that's used by the image cache implementation.