store

package
v0.7.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(host string, gracePeriod time.Duration, closing chan struct{}, key string) (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) Close

func (d *DataStore) Close()

Close close mongo client session

func (*DataStore) CreateEvent

func (d *DataStore) CreateEvent(event *api.Event) (*api.Event, error)

CreateEvent creates the event with the initial status `in`.

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) DeleteCloudByName

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

DeleteCloudByName delete a cloud in db by name

func (*DataStore) DeleteEvent

func (d *DataStore) DeleteEvent(id string) error

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) FindAllClouds

func (d *DataStore) FindAllClouds() ([]api.Cloud, error)

FindAllClouds returns all clouds

func (*DataStore) FindCloudByName

func (d *DataStore) FindCloudByName(name string) (*api.Cloud, error)

FindCloudByName returns a cloud in db by name

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) 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) FindPipelineRecordsByStartTime

func (d *DataStore) FindPipelineRecordsByStartTime(pipelineID string, start, end time.Time) ([]api.PipelineRecord, int, error)

FindPipelineRecordsByStartTime finds the pipeline records by startTime.

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) FindRecentRecordsByPipelineID

func (d *DataStore) FindRecentRecordsByPipelineID(pipelineID string, filter map[string]interface{}, limit int) ([]api.PipelineRecord, int, error)

FindRecentRecordsByPipelineID finds a set of records with conditions by pipeline ID.

func (*DataStore) FindRecordsWithPaginationByPipelineID

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

FindRecordsWithPaginationByPipelineID finds a page of records with conditions by pipeline ID.

func (*DataStore) FindRotateRecords

func (d *DataStore) FindRotateRecords(pipelineID string, n int) ([]api.PipelineRecord, int, error)

FindRotateRecords finds all records inserted earlier than other n records.

func (*DataStore) GetEventByID

func (d *DataStore) GetEventByID(id string) (*api.Event, error)

GetEventByID gets the event by id.

func (*DataStore) GetEventByRecordID added in v0.7.1

func (d *DataStore) GetEventByRecordID(id string) (*api.Event, error)

GetEventByRecordID gets the event by pipeline record id.

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(c *api.Cloud) error

InsertCloud insert a new cloud document to db

func (*DataStore) NextEvent

func (d *DataStore) NextEvent() (*api.Event, error)

NextEvent get the next event with conditions: * sorted by `inTime`, first in first out; * with status status `in`; * has been out more than the threshold.

func (*DataStore) Ping

func (d *DataStore) Ping() error

Ping ping mongo server

func (*DataStore) ResetEvent

func (d *DataStore) ResetEvent(event *api.Event) error

func (*DataStore) UpdateEvent

func (d *DataStore) UpdateEvent(event *api.Event) error

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) UpsertCloud

func (d *DataStore) UpsertCloud(c *api.Cloud) error

UpsertCloud insert a new cloud document to db

Jump to

Keyboard shortcuts

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