1 
2 /**
3  *    Copyright (C) 2018-present MongoDB, Inc.
4  *
5  *    This program is free software: you can redistribute it and/or modify
6  *    it under the terms of the Server Side Public License, version 1,
7  *    as published by MongoDB, Inc.
8  *
9  *    This program is distributed in the hope that it will be useful,
10  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *    Server Side Public License for more details.
13  *
14  *    You should have received a copy of the Server Side Public License
15  *    along with this program. If not, see
16  *    <http://www.mongodb.com/licensing/server-side-public-license>.
17  *
18  *    As a special exception, the copyright holders give permission to link the
19  *    code of portions of this program with the OpenSSL library under certain
20  *    conditions as described in each individual source file and distribute
21  *    linked combinations including the program with the OpenSSL library. You
22  *    must comply with the Server Side Public License in all respects for
23  *    all of the code used other than as permitted herein. If you modify file(s)
24  *    with this exception, you may extend this exception to your version of the
25  *    file(s), but you are not obligated to do so. If you do not wish to do so,
26  *    delete this exception statement from your version. If you delete this
27  *    exception statement from all source files in the program, then also delete
28  *    it in the license file.
29  */
30 
31 #pragma once
32 
33 #include <string>
34 
35 /*
36  * This file defines the storage for options that come from the command line related to the
37  * mmap v1 storage engine.
38  */
39 
40 namespace mongo {
41 
42 struct MMAPV1Options {
MMAPV1OptionsMMAPV1Options43     MMAPV1Options()
44         : lenForNewNsFiles(16 * 1024 * 1024),
45           preallocj(true),
46           prealloc(false),
47           quota(false),
48           quotaFiles(8) {}
49 
50     // --nssize
51     // Specifies the default size for namespace files, which are files that end in .ns.
52     // Each collection and index counts as a namespace.
53     unsigned lenForNewNsFiles;
54 
55     bool preallocj;   // --nopreallocj no preallocation of journal files
56     bool prealloc;    // --noprealloc no preallocation of data files
57     bool smallfiles;  // --smallfiles allocate smaller data files
58 
59     // --journalOptions 7            dump journal and terminate without doing anything further
60     // --journalOptions 4            recover and terminate without listening
61     enum {                         // bits to be ORed
62         JournalDumpJournal = 1,    // dump diagnostics on the journal during recovery
63         JournalScanOnly = 2,       // don't do any real work, just scan and dump if dump
64                                    // specified
65         JournalRecoverOnly = 4,    // terminate after recovery step
66         JournalParanoid = 8,       // paranoid mode enables extra checks
67         JournalAlwaysCommit = 16,  // do a group commit every time the writelock is released
68         JournalAlwaysRemap = 32,   // remap the private view after every group commit
69                                    // (may lag to the next write lock acquisition,
70                                    // but will do all files then)
71         JournalNoCheckSpace = 64   // don't check that there is enough room for journal files
72                                    // before startup (for diskfull tests)
73     };
74     int journalOptions;  // --journalOptions <n> for debugging
75 
76     // --quota
77     // Enables a maximum limit for the number data files each database can have.
78     // When running with the --quota option, MongoDB has a maximum of 8 data files
79     // per database. Adjust the quota with --quotaFiles.
80     bool quota;
81 
82     // --quotaFiles
83     // Modifies the limit on the number of data files per database.
84     // --quotaFiles option requires that you set --quota.
85     int quotaFiles;  // --quotaFiles
86 };
87 
88 extern MMAPV1Options mmapv1GlobalOptions;
89 
90 }  // namespace mongo
91