Documentation ¶
Index ¶
- Constants
- type SoftwareImagesStorage
- func (i *SoftwareImagesStorage) Delete(ctx context.Context, id string) error
- func (i *SoftwareImagesStorage) Exists(ctx context.Context, id string) (bool, error)
- func (i *SoftwareImagesStorage) FindAll(ctx context.Context) ([]*images.SoftwareImage, error)
- func (i *SoftwareImagesStorage) FindByID(ctx context.Context, id string) (*images.SoftwareImage, error)
- func (i *SoftwareImagesStorage) ImageByNameAndDeviceType(ctx context.Context, name, deviceType string) (*images.SoftwareImage, error)
- func (i *SoftwareImagesStorage) IndexStorage(ctx context.Context) error
- func (i *SoftwareImagesStorage) Insert(ctx context.Context, image *images.SoftwareImage) error
- func (i *SoftwareImagesStorage) IsArtifactUnique(ctx context.Context, artifactName string, deviceTypesCompatible []string) (bool, error)
- func (i *SoftwareImagesStorage) Update(ctx context.Context, image *images.SoftwareImage) (bool, error)
Constants ¶
const ( // Keys are corelated to field names in SoftwareImageMeta // and SoftwareImageMetaArtifact structures // Need to be kept in sync with that structure filed names StorageKeySoftwareImageDeviceTypes = "meta_artifact.device_types_compatible" StorageKeySoftwareImageName = "meta_artifact.name" StorageKeySoftwareImageId = "_id" )
Database KEYS
const ( DatabaseName = "deployment_service" CollectionImages = "images" )
Database
const (
IndexUniqeNameAndDeviceTypeStr = "uniqueNameAndDeviceTypeIndex"
)
Indexes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SoftwareImagesStorage ¶
type SoftwareImagesStorage struct {
// contains filtered or unexported fields
}
SoftwareImagesStorage is a data layer for SoftwareImages based on MongoDB Implements model.SoftwareImagesStorage
func NewSoftwareImagesStorage ¶
func NewSoftwareImagesStorage(session *mgo.Session) *SoftwareImagesStorage
NewSoftwareImagesStorage new data layer object
func (*SoftwareImagesStorage) Delete ¶
func (i *SoftwareImagesStorage) Delete(ctx context.Context, id string) error
Delete image specified by ID Noop on if not found.
func (*SoftwareImagesStorage) FindAll ¶
func (i *SoftwareImagesStorage) FindAll(ctx context.Context) ([]*images.SoftwareImage, error)
FindAll lists all images
func (*SoftwareImagesStorage) FindByID ¶
func (i *SoftwareImagesStorage) FindByID(ctx context.Context, id string) (*images.SoftwareImage, error)
FindByID search storage for image with ID, returns nil if not found
func (*SoftwareImagesStorage) ImageByNameAndDeviceType ¶
func (i *SoftwareImagesStorage) ImageByNameAndDeviceType(ctx context.Context, name, deviceType string) (*images.SoftwareImage, error)
ImageByNameAndDeviceType find image with speficied application name and targed device type
func (*SoftwareImagesStorage) IndexStorage ¶
func (i *SoftwareImagesStorage) IndexStorage(ctx context.Context) error
IndexStorage set required indexes. * Set unique index on name-model image keys.
func (*SoftwareImagesStorage) Insert ¶
func (i *SoftwareImagesStorage) Insert(ctx context.Context, image *images.SoftwareImage) error
Insert persists object
func (*SoftwareImagesStorage) IsArtifactUnique ¶
func (i *SoftwareImagesStorage) IsArtifactUnique(ctx context.Context, artifactName string, deviceTypesCompatible []string) (bool, error)
IsArtifactUnique checks if there is no artifact with the same artifactName supporting one of the device types from deviceTypesCompatible list. Returns true, nil if artifact is unique; false, nil if artifact is not unique; false, error in case of error.
func (*SoftwareImagesStorage) Update ¶
func (i *SoftwareImagesStorage) Update(ctx context.Context, image *images.SoftwareImage) (bool, error)
Update proviced SoftwareImage Return false if not found