Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Added JS docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tobilg committed Dec 9, 2016
1 parent 72f3768 commit d7fad06
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,9 @@ Scheduler.prototype.getRunningTasks = function () {

};

/**
* Synchronize the tasks of this scheduler.
*/
Scheduler.prototype.sync = function () {
var self = this;
for (var i = 0; i < self.reconcileTasks.length; i++) {
Expand Down
17 changes: 16 additions & 1 deletion lib/taskHelper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"use strict";

/**
* Represents a TaskHelper object
* @constructor
* @param {object} scheduler - The scheduler object.
*/
function TaskHelper(scheduler) {
if (!(this instanceof TaskHelper)) {
return new TaskHelper(scheduler);
Expand All @@ -11,6 +16,9 @@ function TaskHelper(scheduler) {
self.zkServicePath = self.scheduler.zkServicePath;
}

/**
* Load the task nodes belonging to the framework from ZooKeeper.
*/
TaskHelper.prototype.loadTasks = function() {
var self = this;
self.zkClient.getChildren(self.zkServicePath + "/tasks", function (error, children, stat) {
Expand Down Expand Up @@ -78,7 +86,10 @@ TaskHelper.prototype.loadTasks = function() {
});
};


/**
* Save task nodes from ZooKeeper.
* @param {object} task - The task object which should be persisted to ZooKeeper.
*/
TaskHelper.prototype.saveTask = function (task) {
var self = this;
var data = Buffer(JSON.stringify(task));
Expand All @@ -98,6 +109,10 @@ TaskHelper.prototype.saveTask = function (task) {
});
};

/**
* Delete task nodes from ZooKeeper.
* @param {string} taskId - The id of the task which should be deleted from ZooKeeper.
*/
TaskHelper.prototype.deleteTask = function (taskId) {
var self = this;
self.zkClient.remove(self.zkServicePath + "/tasks/" + taskId, function (error) {
Expand Down

0 comments on commit d7fad06

Please sign in to comment.