Documentation ¶
Index ¶
- Constants
- func ConvertToObjectID(id string) primitive.ObjectID
- func ErrorCheck(err error) error
- func GetStringID(id interface{}) string
- type FileInfo
- type MongoService
- func (db *MongoService) CreateDataset(userId string, dataset openapi.DatasetInfo) (string, error)
- func (db *MongoService) CreateDesign(userId string, design openapi.Design) error
- func (db *MongoService) CreateDesignCode(userId string, designId string, fileName string, fileData *os.File) error
- func (db *MongoService) CreateDesignSchema(userId string, designId string, ds openapi.DesignSchema) error
- func (db *MongoService) CreateJob(userId string, jobSpec openapi.JobSpec) (openapi.JobStatus, error)
- func (db *MongoService) CreateTasks(tasks []objects.Task, dirty bool) error
- func (db *MongoService) DeleteDesign(userId string, designId string) error
- func (db *MongoService) DeleteDesignCode(userId string, designId string) error
- func (db *MongoService) DeleteDesignSchema(userId string, designId string) error
- func (db *MongoService) DeleteJob(userId string, jobId string) error
- func (db *MongoService) DeleteTasks(jobId string, dirty bool) error
- func (db *MongoService) GetComputeById(computeId string) (openapi.ComputeSpec, error)
- func (db *MongoService) GetComputeIdsByRegion(region string) ([]string, error)
- func (db *MongoService) GetDatasetById(datasetId string) (openapi.DatasetInfo, error)
- func (db *MongoService) GetDatasets(userId string, limit int32) ([]openapi.DatasetInfo, error)
- func (db *MongoService) GetDesign(userId string, designId string) (openapi.Design, error)
- func (db *MongoService) GetDesignCode(userId string, designId string) ([]byte, error)
- func (db *MongoService) GetDesignCodeRevision(userId string, designId string) (openapi.CodeApiResponse, error)
- func (db *MongoService) GetDesignSchema(userId string, designId string) (openapi.DesignSchema, error)
- func (db *MongoService) GetDesigns(userId string, limit int32) ([]openapi.DesignInfo, error)
- func (db *MongoService) GetJob(userId string, jobId string) (openapi.JobSpec, error)
- func (db *MongoService) GetJobById(jobId string) (openapi.JobSpec, error)
- func (db *MongoService) GetJobStatus(userId string, jobId string) (openapi.JobStatus, error)
- func (db *MongoService) GetJobs(userId string, limit int32) ([]openapi.JobStatus, error)
- func (db *MongoService) GetJobsByCompute(computeId string) ([]openapi.JobStatus, error)
- func (db *MongoService) GetTask(jobId string, taskId string, key string) (map[string][]byte, error)
- func (db *MongoService) GetTaskInfo(userId string, jobId string, taskId string) (openapi.TaskInfo, error)
- func (db *MongoService) GetTasksInfo(userId string, jobId string, limit int32, inclKey bool) ([]openapi.TaskInfo, error)
- func (db *MongoService) GetTasksInfoGeneric(client string, jobId string, limit int32, inclKey bool, isDeployer bool) ([]openapi.TaskInfo, error)
- func (db *MongoService) IsOneTaskInState(jobId string, state openapi.JobState) bool
- func (db *MongoService) IsOneTaskInStateWithRole(jobId string, state openapi.JobState, role string) bool
- func (db *MongoService) MonitorTasks(jobId string) (chan openapi.TaskInfo, chan error, context.CancelFunc, error)
- func (db *MongoService) RegisterCompute(computeSpec openapi.ComputeSpec) (openapi.ComputeStatus, error)
- func (db *MongoService) SetTaskDirtyFlag(jobId string, dirty bool) error
- func (db *MongoService) UpdateComputeStatus(computeId string, computeStatus openapi.ComputeStatus) (time.Time, error)
- func (db *MongoService) UpdateDeploymentStatus(computeId string, jobId string, agentStatuses map[string]openapi.AgentState) error
- func (db *MongoService) UpdateDesignSchema(userId string, designId string, ds openapi.DesignSchema) error
- func (db *MongoService) UpdateJob(userId string, jobId string, jobSpec openapi.JobSpec) error
- func (db *MongoService) UpdateJobStatus(userId string, jobId string, jobStatus openapi.JobStatus) error
- func (db *MongoService) UpdateTaskStateByFilter(jobId string, newState openapi.JobState, userFilter map[string]interface{}) error
- func (db *MongoService) UpdateTaskStatus(jobId string, taskId string, taskStatus openapi.TaskStatus) error
Constants ¶
const ( DatabaseName = "flame" ComputeCollection = "t_compute" DatasetCollection = "t_dataset" DesignCollection = "t_design" JobCollection = "t_job" TaskCollection = "t_task" DeploymentCollection = "t_deployment" )
Variables ¶
This section is empty.
Functions ¶
func ConvertToObjectID ¶
Tutorial - https://www.mongodb.com/blog/post/quick-start-golang--mongodb--how-to-read-documents
Bson.M vs .D https://stackoverflow.com/questions/64281675/bson-d-vs-bson-m-for-find-queries
func ErrorCheck ¶
func GetStringID ¶
func GetStringID(id interface{}) string
Types ¶
type MongoService ¶
type MongoService struct {
// contains filtered or unexported fields
}
func NewMongoService ¶
func NewMongoService(uri string) (*MongoService, error)
func NewMongoServiceWithClient ¶ added in v0.2.2
func (*MongoService) CreateDataset ¶
func (db *MongoService) CreateDataset(userId string, dataset openapi.DatasetInfo) (string, error)
CreateDataset creates a new dataset entry in the database
func (*MongoService) CreateDesign ¶
func (db *MongoService) CreateDesign(userId string, design openapi.Design) error
CreateDesign create a new design entry in the database
func (*MongoService) CreateDesignCode ¶
func (*MongoService) CreateDesignSchema ¶
func (db *MongoService) CreateDesignSchema(userId string, designId string, ds openapi.DesignSchema) error
CreateDesignSchema adds schema design to the design template information
func (*MongoService) CreateJob ¶
func (db *MongoService) CreateJob(userId string, jobSpec openapi.JobSpec) (openapi.JobStatus, error)
CreateJob creates a new job specification and returns JobStatus
func (*MongoService) CreateTasks ¶
func (db *MongoService) CreateTasks(tasks []objects.Task, dirty bool) error
CreateTasks creates task records in task db collection
func (*MongoService) DeleteDesign ¶ added in v0.1.6
func (db *MongoService) DeleteDesign(userId string, designId string) error
func (*MongoService) DeleteDesignCode ¶ added in v0.1.6
func (db *MongoService) DeleteDesignCode(userId string, designId string) error
func (*MongoService) DeleteDesignSchema ¶ added in v0.1.6
func (db *MongoService) DeleteDesignSchema(userId string, designId string) error
DeleteDesignSchema deletes design schema for the given design Id
func (*MongoService) DeleteJob ¶
func (db *MongoService) DeleteJob(userId string, jobId string) error
func (*MongoService) DeleteTasks ¶
func (db *MongoService) DeleteTasks(jobId string, dirty bool) error
func (*MongoService) GetComputeById ¶ added in v0.1.5
func (db *MongoService) GetComputeById(computeId string) (openapi.ComputeSpec, error)
func (*MongoService) GetComputeIdsByRegion ¶ added in v0.1.5
func (db *MongoService) GetComputeIdsByRegion(region string) ([]string, error)
func (*MongoService) GetDatasetById ¶
func (db *MongoService) GetDatasetById(datasetId string) (openapi.DatasetInfo, error)
func (*MongoService) GetDatasets ¶
func (db *MongoService) GetDatasets(userId string, limit int32) ([]openapi.DatasetInfo, error)
func (*MongoService) GetDesignCode ¶
func (db *MongoService) GetDesignCode(userId string, designId string) ([]byte, error)
func (*MongoService) GetDesignCodeRevision ¶ added in v0.3.0
func (db *MongoService) GetDesignCodeRevision(userId string, designId string) (openapi.CodeApiResponse, error)
func (*MongoService) GetDesignSchema ¶
func (db *MongoService) GetDesignSchema(userId string, designId string) (openapi.DesignSchema, error)
func (*MongoService) GetDesigns ¶
func (db *MongoService) GetDesigns(userId string, limit int32) ([]openapi.DesignInfo, error)
GetDesigns get a lists of all the designs created by the user TODO: update the method to implement a limit next based cursor
func (*MongoService) GetJobById ¶
func (db *MongoService) GetJobById(jobId string) (openapi.JobSpec, error)
func (*MongoService) GetJobStatus ¶
func (*MongoService) GetJobsByCompute ¶ added in v0.2.3
func (db *MongoService) GetJobsByCompute(computeId string) ([]openapi.JobStatus, error)
func (*MongoService) GetTaskInfo ¶ added in v0.1.2
func (*MongoService) GetTasksInfo ¶
func (*MongoService) GetTasksInfoGeneric ¶ added in v0.1.5
func (db *MongoService) GetTasksInfoGeneric(client string, jobId string, limit int32, inclKey bool, isDeployer bool) ([]openapi.TaskInfo, error)
This is a generic function to return a list of task information. Two types of clients us it: (a) users and (b) deployers. If the client is a user, the taskInfo may or may not include taskKey (as required). If the deployer calls it, the taskKey is likely to be returned.
func (*MongoService) IsOneTaskInState ¶
func (db *MongoService) IsOneTaskInState(jobId string, state openapi.JobState) bool
IsOneTaskInState returns true if the state of at least one task is set to the given state. Otherwise, it returns false.
func (*MongoService) IsOneTaskInStateWithRole ¶
func (*MongoService) MonitorTasks ¶
func (db *MongoService) MonitorTasks(jobId string) (chan openapi.TaskInfo, chan error, context.CancelFunc, error)
MonitorTasks creates and returns a watcher to monitor state changes of tasks in a job
func (*MongoService) RegisterCompute ¶ added in v0.1.5
func (db *MongoService) RegisterCompute(computeSpec openapi.ComputeSpec) (openapi.ComputeStatus, error)
RegisterCompute creates a new cluster compute specification and returns ComputeStatus
func (*MongoService) SetTaskDirtyFlag ¶
func (db *MongoService) SetTaskDirtyFlag(jobId string, dirty bool) error
func (*MongoService) UpdateComputeStatus ¶ added in v0.1.5
func (db *MongoService) UpdateComputeStatus(computeId string, computeStatus openapi.ComputeStatus) (time.Time, error)
UpdateComputeStatus update compute cluster's status
func (*MongoService) UpdateDeploymentStatus ¶ added in v0.1.6
func (db *MongoService) UpdateDeploymentStatus(computeId string, jobId string, agentStatuses map[string]openapi.AgentState) error
func (*MongoService) UpdateDesignSchema ¶
func (db *MongoService) UpdateDesignSchema(userId string, designId string, ds openapi.DesignSchema) error
func (*MongoService) UpdateJobStatus ¶
func (db *MongoService) UpdateJobStatus(userId string, jobId string, jobStatus openapi.JobStatus) error
UpdateJobStatus update Job's status
func (*MongoService) UpdateTaskStateByFilter ¶
func (db *MongoService) UpdateTaskStateByFilter(jobId string, newState openapi.JobState, userFilter map[string]interface{}) error
UpdateTaskStateByFilter updates the status of tasks on a particular state in a job. The function should be only called by a system; hence, this function shouldn't become open to user API
func (*MongoService) UpdateTaskStatus ¶
func (db *MongoService) UpdateTaskStatus(jobId string, taskId string, taskStatus openapi.TaskStatus) error