Documentation ¶
Overview ¶
Package sqlite defines an implementation for the store as an SQLite database
Index ¶
- Constants
- func NewSqliteStore(dbpath string) (database.Store, error)
- type Store
- func (s Store) AddBootSetupToMachine(bootSetup *images.BootSetup) error
- func (s Store) AddImageToImageSetup(setup *images.ImageSetup, image *images.ImageModel, version images.Version, ...)
- func (s Store) CreateImage(image *images.ImageModel)
- func (s Store) CreateImageSetup(username string, image *images.ImageSetup) error
- func (s Store) CreateMachine(machine *machine.MachineModel) error
- func (s Store) CreateMachineImage(image *images.MachineImageModel)
- func (s Store) CreateNewImageVersion(version images.Version)
- func (s Store) CreateUser(user *user.UserModel) error
- func (s Store) DeleteImage(image *images.ImageModel) error
- func (s Store) DeleteImageSetup(imageSetup *images.ImageSetup) error
- func (s Store) DeleteMachine(machine *machine.MachineModel) error
- func (s Store) FindImageSetupsByUsername(username string) (*[]images.ImageSetup, error)
- func (s Store) GetImageByUUID(uuid images.ImageUUID) (*images.ImageModel, error)
- func (s Store) GetImageSetup(uuid string) (images.ImageSetup, error)
- func (s Store) GetImageSetups(username string) (*[]images.ImageSetup, error)
- func (s Store) GetImagesByNameAndUsername(name string, username string) ([]images.ImageModel, error)
- func (s Store) GetImagesByUsername(username string) ([]images.ImageModel, error)
- func (s Store) GetMachineByMac(mac util.MacAddress) (*machine.MachineModel, error)
- func (s Store) GetMachineImageByMac(mac util.MacAddress) (*images.MachineImageModel, error)
- func (s Store) GetMachineImageByUUID(uuid images.ImageUUID) (*images.MachineImageModel, error)
- func (s Store) GetMachines() (machines []machine.MachineModel, _ error)
- func (s Store) GetNextBootSetup(machineMAC string) (*images.BootSetup, error)
- func (s Store) GetUserByID(id uint) (*user.UserModel, error)
- func (s Store) GetUserByUsername(name string) (*user.UserModel, error)
- func (s Store) GetUsers() (users []user.UserModel, _ error)
- func (s Store) GetVersionByID(versionID uint64) (*images.Version, error)
- func (s Store) ModifyImageSetup(imageSetup *images.ImageSetup) error
- func (s Store) ModifyUser(user *user.UserModel) error
- func (s Store) RemoveImageFromImageSetup(setup *images.ImageSetup, targetImage *images.ImageModel, ...) error
- func (s Store) RemoveUser(user *user.UserModel) error
- func (s Store) UpdateImage(image *images.ImageModel) error
- func (s Store) UpdateMachine(machine *machine.MachineModel) error
Constants ¶
const InMemoryPath = "file::memory:"
InMemoryPath is the path inside the memory pointing to the database
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
Store is the database structure
func (Store) AddBootSetupToMachine ¶
AddBootSetupToMachine adds a configuration for booting to the specified machine
func (Store) AddImageToImageSetup ¶
func (s Store) AddImageToImageSetup(setup *images.ImageSetup, image *images.ImageModel, version images.Version, update bool)
AddImageToImageSetup adds an image pegged to a particular version to the setup.
func (Store) CreateImage ¶
func (s Store) CreateImage(image *images.ImageModel)
CreateImage creates the image entity in the database and adds the first version to it.
func (Store) CreateImageSetup ¶
func (s Store) CreateImageSetup(username string, image *images.ImageSetup) error
CreateImageSetup creates a collection of images in history.
func (Store) CreateMachine ¶
func (s Store) CreateMachine(machine *machine.MachineModel) error
CreateMachine creates the machine in the database
func (Store) CreateMachineImage ¶
func (s Store) CreateMachineImage(image *images.MachineImageModel)
CreateMachineImage creates the image entity in the database and adds the first version to it.
func (Store) CreateNewImageVersion ¶
CreateNewImageVersion creates a new version in the database
func (Store) CreateUser ¶
CreateUser creates a new user
func (Store) DeleteImage ¶
func (s Store) DeleteImage(image *images.ImageModel) error
DeleteImage removes an image from the database
func (Store) DeleteImageSetup ¶
func (s Store) DeleteImageSetup(imageSetup *images.ImageSetup) error
DeleteImageSetup deletes an image setup
func (Store) DeleteMachine ¶
func (s Store) DeleteMachine(machine *machine.MachineModel) error
DeleteMachine removes a machine from the database
func (Store) FindImageSetupsByUsername ¶
func (s Store) FindImageSetupsByUsername(username string) (*[]images.ImageSetup, error)
FindImageSetupsByUsername finds all ImageSetups associated with a particular user.
func (Store) GetImageByUUID ¶
GetImageByUUID fetches the image with the versions using their UUID as a key
func (Store) GetImageSetup ¶
func (s Store) GetImageSetup(uuid string) (images.ImageSetup, error)
GetImageSetup an image setup associated with a particular UUID.
func (Store) GetImageSetups ¶
func (s Store) GetImageSetups(username string) (*[]images.ImageSetup, error)
GetImageSetups finds the image setups associated with a user
func (Store) GetImagesByNameAndUsername ¶
func (s Store) GetImagesByNameAndUsername(name string, username string) ([]images.ImageModel, error)
GetImagesByNameAndUsername gets all the images associated with a user which have the same human-readable name. This theoretically possible, but it is unsure whether this actually holds in any real-world scenario.
func (Store) GetImagesByUsername ¶
func (s Store) GetImagesByUsername(username string) ([]images.ImageModel, error)
GetImagesByUsername fetches all the images associated to a user.
func (Store) GetMachineByMac ¶
func (s Store) GetMachineByMac(mac util.MacAddress) (*machine.MachineModel, error)
GetMachineByMac gets any machine with the associated MAC addresses from the database
func (Store) GetMachineImageByMac ¶
func (s Store) GetMachineImageByMac(mac util.MacAddress) (*images.MachineImageModel, error)
GetMachineImageByMac fetches the image with the versions using mac address of their machine as a key
func (Store) GetMachineImageByUUID ¶
GetMachineImageByUUID gets the machine image associated with a UUID
func (Store) GetMachines ¶
func (s Store) GetMachines() (machines []machine.MachineModel, _ error)
GetMachines returns the values in the machine_models database. TODO: Fetch foreign relations.
func (Store) GetNextBootSetup ¶
GetNextBootSetup fetches the first machine from the database.
func (Store) GetUserByID ¶
GetUserByID gets the user with the specified id from the database.
func (Store) GetUserByUsername ¶
GetUserByUsername gets the first user with the associated username from the database.
func (Store) GetVersionByID ¶
GetVersionByID gets the version associated with a specific ID
func (Store) ModifyImageSetup ¶
func (s Store) ModifyImageSetup(imageSetup *images.ImageSetup) error
ModifyImageSetup changes the metadata of an image setup
func (Store) ModifyUser ¶
ModifyUser modifies a user
func (Store) RemoveImageFromImageSetup ¶
func (s Store) RemoveImageFromImageSetup(setup *images.ImageSetup, targetImage *images.ImageModel, version images.Version, update bool) error
RemoveImageFromImageSetup removes a particular iamge from the image setup
func (Store) RemoveUser ¶
RemoveUser deletes a user from the database
func (Store) UpdateImage ¶
func (s Store) UpdateImage(image *images.ImageModel) error
UpdateImage updates an image in the database
func (Store) UpdateMachine ¶
func (s Store) UpdateMachine(machine *machine.MachineModel) error
UpdateMachine updates the information about the machine or creates a machine where one does not yet exist.