summaryrefslogtreecommitdiff
path: root/jstests/concurrency/fsm_utils/name_utils.js
blob: 4c9d6d85fbbd0bcd11d4b46d014bf288f23ca91e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';

/**
 * Helpers for generating names of databases and collections
 * to execute workloads against.
 * The DB and collections names here are synchronized with the
 * the names found in the CleanupConcurrencyWorkloads hook
 * in resmoke.
 */

if (typeof uniqueDBName === 'undefined') {
    // Returns a unique database name:
    //   <dbNamePrefix>fsmdb0, <dbNamePrefix>fsmdb1, ...
    var uniqueDBName = (function(dbNamePrefix) {
        var i = 0;

        return function(dbNamePrefix) {
            var prefix = dbNamePrefix || '';
            return prefix + 'fsmdb' + i++;
        };
    })();
}

if (typeof uniqueCollName === 'undefined') {
    // Returns a unique collection name:
    //   fsmcoll0, fsmcoll1, ...
    var uniqueCollName = (function() {
        var i = 0;

        return function() {
            return 'fsmcoll' + i++;
        };
    })();
}