repository

package
v0.0.0-...-c50b06b Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileExtSVG = ".svg"
	FileExtPNG = ".png"
)
View Source
const (
	FileExtQCOW = ".qcow2"
	FileExtRAW  = ".raw"
	FileExtISO  = ".iso"
)

Variables

This section is empty.

Functions

func NewImage

func NewImage(fi os.FileInfo) (*api.Image, error)

NewImage for fileinfo

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

func NewFilesystemImageRepo(path string) ImageRepo

NewFilesystemImageRepo for repository resident in filesystem (images path)

Jump to

Keyboard shortcuts

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