~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to src/mongo/base/initializer.h

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*    Copyright 2012 10gen Inc.
 
2
 *
 
3
 *    Licensed under the Apache License, Version 2.0 (the "License");
 
4
 *    you may not use this file except in compliance with the License.
 
5
 *    You may obtain a copy of the License at
 
6
 *
 
7
 *    http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
9
 *    Unless required by applicable law or agreed to in writing, software
 
10
 *    distributed under the License is distributed on an "AS IS" BASIS,
 
11
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
 *    See the License for the specific language governing permissions and
 
13
 *    limitations under the License.
 
14
 */
 
15
 
 
16
#pragma once
 
17
 
 
18
#include <string>
 
19
#include <vector>
 
20
 
 
21
#include "mongo/base/configuration_variable_manager.h"
 
22
#include "mongo/base/disallow_copying.h"
 
23
#include "mongo/base/initializer_context.h"
 
24
#include "mongo/base/initializer_dependency_graph.h"
 
25
#include "mongo/base/status.h"
 
26
 
 
27
namespace mongo {
 
28
 
 
29
    /**
 
30
     * Class representing an initialization process.
 
31
     *
 
32
     * Such a process is described by a directed acyclic graph of initialization operations, the
 
33
     * InitializerDependencyGraph, and a collection of mutable global state, the
 
34
     * ConfigurationVariableManager.  One constructs an initialization process by adding nodes and
 
35
     * edges to the graph, and variable mappings in the variable manager.  Then, one executes the
 
36
     * process, causing each initialization operation to execute in an order that respects the
 
37
     * programmer-established prerequistes.
 
38
     */
 
39
    class Initializer {
 
40
        MONGO_DISALLOW_COPYING(Initializer);
 
41
    public:
 
42
        Initializer();
 
43
        ~Initializer();
 
44
 
 
45
        /**
 
46
         * Get the initializer dependency graph, presumably for the purpose of adding more nodes.
 
47
         */
 
48
        InitializerDependencyGraph& getInitializerDependencyGraph() { return _graph; }
 
49
 
 
50
        /**
 
51
         * Get the configuration variable manager, for the purpose of describing more configurable
 
52
         * variables.
 
53
         */
 
54
        ConfigurationVariableManager& getConfigurationVariableManager() { return _configVariables; }
 
55
 
 
56
        /**
 
57
         * Execute the initializer process, using the given argv and environment data as input.
 
58
         *
 
59
         * Returns Status::OK on success.  All other returns constitute initialization failures,
 
60
         * and the thing being initialized should be considered dead in the water.
 
61
         */
 
62
        Status execute(const InitializerContext::ArgumentVector& args,
 
63
                       const InitializerContext::EnvironmentMap& env) const;
 
64
 
 
65
    private:
 
66
 
 
67
        InitializerDependencyGraph _graph;
 
68
        ConfigurationVariableManager _configVariables;
 
69
    };
 
70
 
 
71
    /**
 
72
     * Run the global initializers.
 
73
     *
 
74
     * It's a programming error for this to fail, but if it does it will return a status other
 
75
     * than Status::OK.
 
76
     *
 
77
     * This means that the few initializers that might want to terminate the program by failing
 
78
     * should probably arrange to terminate the process themselves.
 
79
     */
 
80
    Status runGlobalInitializers(const InitializerContext::ArgumentVector& args,
 
81
                                 const InitializerContext::EnvironmentMap& env);
 
82
 
 
83
    /**
 
84
     * Same as runGlobalInitializers(), except prints a brief message to std::cerr
 
85
     * and terminates the process on failure.
 
86
     */
 
87
    void runGlobalInitializersOrDie(const InitializerContext::ArgumentVector& args,
 
88
                                    const InitializerContext::EnvironmentMap& env);
 
89
 
 
90
    void runGlobalInitializersOrDie(int argc, const char* const* argv, const char* const* envp);
 
91
 
 
92
}  // namespace mongo