mongo

package
v0.0.0-...-4c6cade Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
const (
	DatabaseName     = "deployment_service"
	CollectionImages = "images"
)

Database

View Source
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) Exists

func (i *SoftwareImagesStorage) Exists(ctx context.Context, id string) (bool, error)

Exists checks if object with ID exists

func (*SoftwareImagesStorage) FindAll

FindAll lists all images

func (*SoftwareImagesStorage) FindByID

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

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

Update proviced SoftwareImage Return false if not found

Jump to

Keyboard shortcuts

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