summaryrefslogtreecommitdiff
path: root/share/server/state.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-12-22 18:03:44 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-12-22 18:03:44 +0000
commitea3b1153e52ac1513da4d634eedefb05c261039c (patch)
tree858c5b3d81509bfe784b8d2d1252921cbf34aa54 /share/server/state.js
parent22c551bb103072826c0299265670d1483c753dde (diff)
move query server to a design-doc based protocol, closes COUCHDB-589
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@893249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/server/state.js')
-rw-r--r--share/server/state.js36
1 files changed, 14 insertions, 22 deletions
diff --git a/share/server/state.js b/share/server/state.js
index b9bd87aa..9af9e475 100644
--- a/share/server/state.js
+++ b/share/server/state.js
@@ -10,26 +10,18 @@
// License for the specific language governing permissions and limitations under
// the License.
-// globals used by other modules and functions
-var funs = []; // holds functions used for computation
-var funsrc = []; // holds function source for debug info
-var query_config = {};
-var State = (function() {
- return {
- reset : function(config) {
- // clear the globals and run gc
- funs = [];
- funsrc = [];
- query_config = config;
- init_sandbox();
- gc();
- print("true"); // indicates success
- },
- addFun : function(newFun) {
- // Compile to a function and add it to funs array
- funsrc.push(newFun);
- funs.push(compileFunction(newFun));
- print("true");
- }
+var State = {
+ reset : function(config) {
+ // clear the globals and run gc
+ State.funs = [];
+ State.query_config = config || {};
+ init_sandbox();
+ gc();
+ print("true"); // indicates success
+ },
+ addFun : function(newFun) {
+ // Compile to a function and add it to funs array
+ State.funs.push(Couch.compileFunction(newFun));
+ print("true");
}
-})();
+}