summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/engine.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/scripting/engine.h')
-rw-r--r--src/mongo/scripting/engine.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h
index 8233128e736..0bbe1a84d4f 100644
--- a/src/mongo/scripting/engine.h
+++ b/src/mongo/scripting/engine.h
@@ -25,6 +25,7 @@ namespace mongo {
typedef map<string, ScriptingFunction> FunctionCacheMap;
class DBClientWithCommands;
+ class DBClientBase;
struct JSFile {
const char* name;
@@ -57,7 +58,7 @@ namespace mongo {
virtual void setElement(const char* field, const BSONElement& e) = 0;
virtual void setNumber(const char* field, double val) = 0;
- virtual void setString(const char* field, const char* val) = 0;
+ virtual void setString(const char* field, const StringData& val) = 0;
virtual void setObject(const char* field, const BSONObj& obj, bool readOnly=true) = 0;
virtual void setBoolean(const char* field, bool val) = 0;
virtual void setFunction(const char* field, const char* code) = 0;
@@ -135,10 +136,10 @@ namespace mongo {
static void validateObjectIdString(const string& str);
/** increments the number of times a scope was used */
- void incTimeUsed() { ++_numTimeUsed; }
+ void incTimesUsed() { ++_numTimesUsed; }
/** gets the number of times a scope was used */
- int getTimeUsed() { return _numTimeUsed; }
+ int getTimesUsed() { return _numTimesUsed; }
/** return true if last invoke() return'd native code */
virtual bool isLastRetNativeCode() { return _lastRetIsNativeCode; }
@@ -168,7 +169,7 @@ namespace mongo {
set<string> _storedNames;
static long long _lastVersion;
FunctionCacheMap _cachedFunctions;
- int _numTimeUsed;
+ int _numTimesUsed;
bool _lastRetIsNativeCode; // v8 only: set to true if eval'd script returns a native func
};
@@ -188,15 +189,12 @@ namespace mongo {
static void setup();
/** gets a scope from the pool or a new one if pool is empty
- * @param pool An identifier for the pool, usually the db name
+ * @param db The db name
+ * @param scopeType A unique id to limit scope sharing.
+ * This must include authenticated users.
* @return the scope
*/
- auto_ptr<Scope> getPooledScope(const string& pool, const string& scopeType);
-
- /**
- * call this method to release some JS resources when a thread is done
- */
- void threadDone();
+ auto_ptr<Scope> getPooledScope(const string& db, const string& scopeType);
void setScopeInitCallback(void (*func)(Scope&)) { _scopeInitCallback = func; }
static void setConnectCallback(void (*func)(DBClientWithCommands&)) {
@@ -248,4 +246,5 @@ namespace mongo {
const char* jsSkipWhiteSpace(const char* raw);
extern ScriptEngine* globalScriptEngine;
+ extern DBClientBase* directDBClient;
}