Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceCollectionName string = "ResourceCollection"
	CloudsCollection       string = "clouds"
)

Variables

This section is empty.

Functions

func FindServiceAndVersion added in v0.3.0

func FindServiceAndVersion(versionID string) (*api.Service, *api.Version, error)

findVersionAndService finds service and version entity based on version id.

func Init

func Init(host string, gracePeriod time.Duration, closing chan struct{}) (*mgo.Session, chan struct{}, error)

Init store mongo client session

Types

type DataStore

type DataStore struct {
	// contains filtered or unexported fields
}

DataStore is the type for mongo db store.

func NewStore

func NewStore() *DataStore

NewStore copy a mongo client session

func (*DataStore) AddNewFailVersion

func (d *DataStore) AddNewFailVersion(serviceID string, versionID string) error

AddNewFailVersion adds a new fail version (version ID) to a given service.

func (*DataStore) AddNewVersion

func (d *DataStore) AddNewVersion(serviceID string, versionID string) error

AddNewVersion adds a new success version (version ID) to a given service.

func (*DataStore) Close

func (d *DataStore) Close()

Close close mongo client session

func (*DataStore) CreatePipeline

func (d *DataStore) CreatePipeline(pipeline *api.Pipeline) (*api.Pipeline, error)

CreatePipeline creates the pipeline, returns the pipeline created.

func (*DataStore) CreatePipelineRecord

func (d *DataStore) CreatePipelineRecord(pipelineRecord *api.PipelineRecord) (*api.PipelineRecord, error)

CreatePipelineRecord creates the pipeline record, returns the pipeline record created.

func (*DataStore) CreateProject

func (d *DataStore) CreateProject(project *api.Project) (*api.Project, error)

CreateProject creates the project, returns the project created.

func (*DataStore) CreateToken

func (d *DataStore) CreateToken(token *api.ScmToken) (*api.ScmToken, error)

CreateToken creates creates the token, returns the token created.

func (*DataStore) DeleteCloudByName

func (d *DataStore) DeleteCloudByName(name string) error

DeleteCloudByName delete a cloud in db by name

func (*DataStore) DeleteDeployByID

func (d *DataStore) DeleteDeployByID(deployID string) error

DeleteDeployByID removes deploy by deploy_id.

func (*DataStore) DeletePipelineByID

func (d *DataStore) DeletePipelineByID(pipelineID string) error

DeletePipelineByID deletes the pipeline by id.

func (*DataStore) DeletePipelineRecordByID

func (d *DataStore) DeletePipelineRecordByID(pipelineRecordID string) error

DeletePipelineRecordByID deletes the pipeline record by id.

func (*DataStore) DeletePipelineRecordsByPipelineID

func (d *DataStore) DeletePipelineRecordsByPipelineID(pipelineID string) error

DeletePipelineRecordsByPipelineID deletes all the pipeline records of one pipeline by pipeline id.

func (*DataStore) DeletePipelinesByProjectID

func (d *DataStore) DeletePipelinesByProjectID(projectID string) error

DeletePipelinesByProjectID deletes all the pipelines in one project by project id.

func (*DataStore) DeleteProjectByID

func (d *DataStore) DeleteProjectByID(projectID string) error

DeleteProjectByID deletes the project by id.

func (*DataStore) DeleteServiceByID

func (d *DataStore) DeleteServiceByID(serviceID string) error

DeleteServiceByID removes service by service_id.

func (*DataStore) DeleteToken

func (d *DataStore) DeleteToken(projectID, scmType string) error

DeleteToken deletes the token with the project id and scm type.

func (*DataStore) DeleteVersionByID

func (d *DataStore) DeleteVersionByID(versionID string) error

DeleteVersionByID removes version by versionID.

func (*DataStore) FindAllClouds

func (d *DataStore) FindAllClouds() ([]cloud.Options, error)

FindAllClouds returns all clouds

func (*DataStore) FindCloudByName

func (d *DataStore) FindCloudByName(name string) (*cloud.Options, error)

FindCloudByName returns a cloud in db by name

func (*DataStore) FindDeployByID

func (d *DataStore) FindDeployByID(deployID string) (*api.Deploy, error)

FindDeployByID finds a deploy entity by ID.

func (*DataStore) FindDeployByUserID

func (d *DataStore) FindDeployByUserID(userID string) ([]api.Deploy, error)

FindDeployByUserID finds deploys entity by userID.

func (*DataStore) FindLatestVersionByServiceID

func (d *DataStore) FindLatestVersionByServiceID(serviceID string) (*api.Version, error)

FindLatestVersionByServiceID finds the latest version entity by service ID.

func (*DataStore) FindPipelineByID

func (d *DataStore) FindPipelineByID(pipelineID string) (*api.Pipeline, error)

FindPipelineByID finds the pipeline by id.

func (*DataStore) FindPipelineByName

func (d *DataStore) FindPipelineByName(projectID string, name string) (*api.Pipeline, error)

FindPipelineByName finds the pipeline by name in one project. If find no pipeline or more than one pipeline, return error.

func (*DataStore) FindPipelineByServiceID added in v0.3.0

func (d *DataStore) FindPipelineByServiceID(serviceID string) (*api.Pipeline, error)

FindPipelineByServiceID finds the pipeline by service id.

func (*DataStore) FindPipelineRecordByID

func (d *DataStore) FindPipelineRecordByID(pipelineRecordID string) (*api.PipelineRecord, error)

FindPipelineRecordByID finds the pipeline record by id.

func (*DataStore) FindPipelineRecordsByPipelineID

func (d *DataStore) FindPipelineRecordsByPipelineID(pipelineID string, queryParams api.QueryParams) ([]api.PipelineRecord, int, error)

FindPipelineRecordsByPipelineID finds the pipeline records by pipelineID.

func (*DataStore) FindPipelinesByProjectID

func (d *DataStore) FindPipelinesByProjectID(projectID string, queryParams api.QueryParams) ([]api.Pipeline, int, error)

FindPipelinesByProjectID finds the pipelines by project id. Will returns all pipelines in this project.

func (*DataStore) FindProjectByID

func (d *DataStore) FindProjectByID(projectID string) (*api.Project, error)

FindProjectByID finds the project by id.

func (*DataStore) FindProjectByName

func (d *DataStore) FindProjectByName(name string) (*api.Project, error)

FindProjectByName finds the project by name. If find no project or more than one project, return error.

func (*DataStore) FindProjectByServiceID added in v0.3.0

func (d *DataStore) FindProjectByServiceID(serviceID string) (*api.Project, error)

FindProjectByServiceID finds the project by service id.

func (*DataStore) FindRecentVersionsByServiceID

func (d *DataStore) FindRecentVersionsByServiceID(serviceID string, filter map[string]interface{}, limit int) ([]api.Version, int, error)

FindRecentVersionsByServiceID finds a set of versions with conditions by service ID.

func (*DataStore) FindResourceByID

func (d *DataStore) FindResourceByID(userID string) (*api.Resource, error)

FindResourceByID finds a resource entity by userID.

func (*DataStore) FindServiceByCondition

func (d *DataStore) FindServiceByCondition(userID, servicename string) ([]api.Service, error)

FindServiceByCondition finds a list of services via user ID and serice name.

func (*DataStore) FindServiceByID

func (d *DataStore) FindServiceByID(serviceID string) (*api.Service, error)

FindServiceByID finds a service entity by ID.

func (*DataStore) FindServicesByUserID

func (d *DataStore) FindServicesByUserID(userID string) ([]api.Service, error)

FindServicesByUserID finds a list of services via user ID.

func (*DataStore) FindVersionByID

func (d *DataStore) FindVersionByID(versionID string) (*api.Version, error)

FindVersionByID finds a version entity by ID.

func (*DataStore) FindVersionLogByID

func (d *DataStore) FindVersionLogByID(LogID string) (*api.VersionLog, error)

FindVersionLogByID finds a version log entity by ID.

func (*DataStore) FindVersionLogByVersionID

func (d *DataStore) FindVersionLogByVersionID(versionID string) (*api.VersionLog, error)

FindVersionLogByVersionID finds a version log entity by version ID.

func (*DataStore) FindVersionsByCondition

func (d *DataStore) FindVersionsByCondition(serviceID, versionname string) ([]api.Version, error)

FindVersionsByCondition finds a version entity by service ID and version name.

func (*DataStore) FindVersionsByServiceID

func (d *DataStore) FindVersionsByServiceID(serviceID string) ([]api.Version, error)

FindVersionsByServiceID finds a version entity by service ID.

func (*DataStore) FindVersionsWithPaginationByServiceID

func (d *DataStore) FindVersionsWithPaginationByServiceID(serviceID string, filter map[string]interface{}, start, limit int) ([]api.Version, int, error)

FindVersionsWithPaginationByServiceID finds a page of versions by service ID.

func (*DataStore) Findtoken

func (d *DataStore) Findtoken(projectID, scmType string) (*api.ScmToken, error)

Findtoken finds the token by project id and scm type.

func (*DataStore) FindtokenByUserID

func (d *DataStore) FindtokenByUserID(userID, urlvsc string) (*api.VscToken, error)

FindtokenByUserID finds token by UserID.

func (*DataStore) GetProjects

func (d *DataStore) GetProjects(queryParams api.QueryParams) ([]api.Project, int, error)

GetProjects gets all projects. Will returns all projects.

func (*DataStore) InsertCloud

func (d *DataStore) InsertCloud(doc *cloud.Options) error

InsertCloud insert a new cloud document to db

func (*DataStore) NewDeployDocument

func (d *DataStore) NewDeployDocument(deploy *api.Deploy) (string, error)

NewDeployDocument creates a new document (record) in mongodb. It returns deploy id of the newly created deploy.

func (*DataStore) NewResourceDocument

func (d *DataStore) NewResourceDocument(resource *api.Resource) error

NewResourceDocument creates a new document (record) in mongodb.

func (*DataStore) NewServiceDocument

func (d *DataStore) NewServiceDocument(service *api.Service) (string, error)

NewServiceDocument creates a new document (record) in mongodb. It returns service id of the newly created service.

func (*DataStore) NewTokenDocument

func (d *DataStore) NewTokenDocument(token *api.VscToken) error

NewTokenDocument creates a new document (record) in mongodb.

func (*DataStore) NewVersionDocument

func (d *DataStore) NewVersionDocument(version *api.Version) (string, error)

NewVersionDocument creates a new document (record) in mongodb. It returns version id of the newly created version.

func (*DataStore) NewVersionLogDocument

func (d *DataStore) NewVersionLogDocument(versionLog *api.VersionLog) (string, error)

NewVersionLogDocument creates a new document (record) in mongodb. It returns version log id of the newly created version.

func (*DataStore) Ping

func (d *DataStore) Ping() error

Ping ping mongo server

func (*DataStore) RemoveTokeninDB

func (d *DataStore) RemoveTokeninDB(userID string, urlvsc string) error

RemoveTokeninDB removes token.

func (*DataStore) UpdatePipeline

func (d *DataStore) UpdatePipeline(pipeline *api.Pipeline) error

UpdatePipeline updates the pipeline, please make sure the pipeline id is provided before call this method.

func (*DataStore) UpdatePipelineRecord

func (d *DataStore) UpdatePipelineRecord(pipelineRecord *api.PipelineRecord) error

UpdatePipelineRecord updates the pipeline record.

func (*DataStore) UpdateProject

func (d *DataStore) UpdateProject(project *api.Project) error

UpdateProject updates the project, please make sure the project id is provided before call this method.

func (*DataStore) UpdateRepositoryStatus

func (d *DataStore) UpdateRepositoryStatus(serviceID string, status api.RepositoryStatus) error

UpdateRepositoryStatus updates service repository status.

func (*DataStore) UpdateResourceDocument

func (d *DataStore) UpdateResourceDocument(resource *api.Resource) error

UpdateResourceDocument update a document (record) in mongodb.

func (*DataStore) UpdateResourceStatus

func (d *DataStore) UpdateResourceStatus(userID string, memory float64, cpu float64) error

UpdateResourceStatus updates resource's memory and cpu.

func (*DataStore) UpdateServiceLastInfo

func (d *DataStore) UpdateServiceLastInfo(serviceID string, lasttime time.Time, lastname string) error

UpdateServiceLastInfo updates service's lastCreateTIme and lastVersionName.

func (*DataStore) UpdateToken

func (d *DataStore) UpdateToken(token *api.VscToken) error

UpdateToken update token via user ID.

func (*DataStore) UpdateToken2

func (d *DataStore) UpdateToken2(token *api.ScmToken) error

UpdateToken2 updates the token, please make sure the project id and scm type is provided before call this method.

func (*DataStore) UpdateVersionDocument

func (d *DataStore) UpdateVersionDocument(versionID string, version api.Version) error

UpdateVersionDocument updates a version entirely.

func (*DataStore) UpdateVersionLogDocument

func (d *DataStore) UpdateVersionLogDocument(versionLog *api.VersionLog) error

UpdateVersionLogDocument updates a document (record) in mongodb.

func (*DataStore) UpsertCloud

func (d *DataStore) UpsertCloud(doc *cloud.Options) error

UpsertCloud insert a new cloud document to db

func (*DataStore) UpsertDeployDocument

func (d *DataStore) UpsertDeployDocument(deploy *api.Deploy) (string, error)

UpsertDeployDocument upsert a special deploy document

func (*DataStore) UpsertServiceDocument

func (d *DataStore) UpsertServiceDocument(service *api.Service) (string, error)

UpsertServiceDocument upsert a special serivce document

Jump to

Keyboard shortcuts

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