Skip to content
Snippets Groups Projects
Commit 84d4be3d authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

Manager: added comments in golang style

parent a5b0efc7
No related branches found
No related tags found
No related merge requests found
......@@ -6,11 +6,13 @@ import (
"gopkg.in/mgo.v2/bson"
)
// Command is an executable part of a Task
type Command struct {
Name string `bson:"name" json:"name"`
Settings bson.M `bson:"settings" json:"settings"`
}
// Task contains a Flamenco task, with some BSON-only fields for local Manager use.
type Task struct {
ID bson.ObjectId `bson:"_id,omitempty" json:"_id,omitempty"`
Etag string `bson:"_etag,omitempty" json:"_etag,omitempty"`
......@@ -35,15 +37,16 @@ type Task struct {
}
type aggregationPipelineResult struct {
// For internal MongoDB querying only
Task *Task `bson:"task"`
}
// Dependency graph response from Server.
// ScheduledTasks contains a dependency graph response from Server.
type ScheduledTasks struct {
Depsgraph []Task `json:"depsgraph"`
}
// Both sent from Worker to Manager, as well as from Manager to Server.
// TaskUpdate is both sent from Worker to Manager, as well as from Manager to Server.
type TaskUpdate struct {
ID bson.ObjectId `bson:"_id" json:"_id"`
TaskID bson.ObjectId `bson:"task_id" json:"task_id,omitempty"`
......@@ -57,13 +60,14 @@ type TaskUpdate struct {
Worker string `bson:"worker" json:"worker"`
}
// Received from Server.
// TaskUpdateResponse is received from Server.
type TaskUpdateResponse struct {
ModifiedCount int `json:"modified_count"`
HandledUpdateIds []bson.ObjectId `json:"handled_update_ids,omitempty"`
CancelTasksIds []bson.ObjectId `json:"cancel_task_ids,omitempty"`
}
// WorkerRegistration is sent by the Worker to register itself at this Manager.
type WorkerRegistration struct {
Secret string `json:"secret"`
Platform string `json:"platform"`
......@@ -71,6 +75,8 @@ type WorkerRegistration struct {
Nickname string `json:"nickname"`
}
// Worker contains all information about a specific Worker.
// Some fields come from the WorkerRegistration, whereas others are filled by us.
type Worker struct {
ID bson.ObjectId `bson:"_id,omitempty" json:"_id,omitempty"`
Secret string `bson:"-" json:"-"`
......@@ -85,10 +91,8 @@ type Worker struct {
SupportedJobTypes []string `bson:"supported_job_types" json:"supported_job_types"`
}
/**
* Notification sent to upstream Flamenco Server upon startup. This is a combination
* of settings (see settings.go) and information from the database.
*/
// StartupNotification sent to upstream Flamenco Server upon startup. This is a combination
// of settings (see settings.go) and information from the database.
type StartupNotification struct {
// Settings
ManagerURL string `json:"manager_url"`
......@@ -98,17 +102,19 @@ type StartupNotification struct {
NumberOfWorkers int `json:"nr_of_workers"`
}
// MayKeepRunningResponse is sent to workers to indicate whether they can keep running their task.
type MayKeepRunningResponse struct {
MayKeepRunning bool `json:"may_keep_running"`
Reason string `json:"reason,omitempty"`
}
// Settings we want to be able to update from within Flamenco Manager itself,
// so those are stored in MongoDB itself.
// SettingsInMongo contains settings we want to be able to update from
// within Flamenco Manager itself, so those are stored in MongoDB.
type SettingsInMongo struct {
DepsgraphLastModified *string `bson:"depsgraph_last_modified"`
}
// StatusReport is sent in response to a query on the / URL.
type StatusReport struct {
NrOfWorkers int `json:"nr_of_workers"`
NrOfTasks int `json:"nr_of_tasks"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment