Documentation ¶
Index ¶
- Constants
- func NewImage(fi os.FileInfo) (*api.Image, error)
- type DomainRepo
- type GraphicsRepo
- func (gr *GraphicsRepo) Find(name string, kind api.GraphicType) string
- func (gr *GraphicsRepo) FindAll(kind api.GraphicType) ([]*api.Graphic, error)
- func (gr *GraphicsRepo) Import(name string, kind api.GraphicType, data []byte) error
- func (gr *GraphicsRepo) ImportDirectory(path string, kind api.GraphicType) error
- func (gr *GraphicsRepo) Remove(name string, kind api.GraphicType) error
- type ImageRepo
Constants ¶
const ( FileExtSVG = ".svg" FileExtPNG = ".png" )
const ( FileExtQCOW = ".qcow2" FileExtRAW = ".raw" FileExtISO = ".iso" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DomainRepo ¶
type DomainRepo interface { // Create domain Create(domain *api.Domain) error // Find domain by uuid Find(uuid string) (*api.Domain, error) // Find all domains FindAll() ([]*api.Domain, error) // Remove domain Remove(uuid string) error // Update existing domain Update(domain *api.Domain) error }
DomainRepo interface
func NewScribbleDomainRepo ¶
func NewScribbleDomainRepo(db *scribble.Driver) DomainRepo
NewScribbleDomainRepo create new domain repo using scribble database
type GraphicsRepo ¶
type GraphicsRepo struct {
// contains filtered or unexported fields
}
GraphicsRepo is used to manage graphics (e.g. desktop icons) on the filesystem
func NewGraphicsRepo ¶
func NewGraphicsRepo(path string) *GraphicsRepo
NewGraphicsRepo returns a new graphics repo with the given path
func (*GraphicsRepo) Find ¶
func (gr *GraphicsRepo) Find(name string, kind api.GraphicType) string
Find returns a path to a graphic, if it exists. Otherwise an empty string is returned.
func (*GraphicsRepo) FindAll ¶
func (gr *GraphicsRepo) FindAll(kind api.GraphicType) ([]*api.Graphic, error)
FindAll returns all the graphics in the repo of type kind. If kind is set to GRAPHIC_UNSPECIFIED, all graphics of all typesd are returned.
func (*GraphicsRepo) Import ¶
func (gr *GraphicsRepo) Import(name string, kind api.GraphicType, data []byte) error
Imports adds a new graphic to the repo. If kind is GRAPHIC_UNSPECIFIED, the graphic will be stored in the base directory of the repository, and will always have type GRAPHIC_UNSPECIFIED when referenced later.
func (*GraphicsRepo) ImportDirectory ¶
func (gr *GraphicsRepo) ImportDirectory(path string, kind api.GraphicType) error
ImportDirectory imports all valid files (i.e. .png, .svg) from a given directory. In the case of a name conflict, old files are over-written by new ones.
If kind is GRAPHIC_UNSPECIFIED, the files from the directory will be imported to the base directory of the repository, and will have type GRAPHIC_UNSPECIFIED when referenced later.
func (*GraphicsRepo) Remove ¶
func (gr *GraphicsRepo) Remove(name string, kind api.GraphicType) error
Remove removes the graphic from the repository
type ImageRepo ¶
type ImageRepo interface { // Create new RAW or QCOW2 image Create(name string, bytes int64) (*api.Image, error) // CreateBacked QCOW2 image backed with another image (raw|qcow2) // If bytes is zero, the size will match backing image CreateBacked(name string, backingImageName string, bytes int64) (*api.Image, error) // Copy one image to another, and return the destination image after // successful creation Copy(source string, destination string) (*api.Image, error) // Find image Find(name string) (*api.Image, error) // Find all images FindAll() ([]*api.Image, error) // Remove image Remove(name string) error }
ImageRepo interface
func NewFilesystemImageRepo ¶
NewFilesystemImageRepo for repository resident in filesystem (images path)