MongoDB C++ Driver legacy-1.1.2
Loading...
Searching...
No Matches
fail_point_registry.h
1/* Copyright 2014 MongoDB 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
20#pragma once
21
22#include "mongo/base/status.h"
23#include "mongo/platform/unordered_map.h"
24#include "mongo/util/fail_point.h"
25
26namespace mongo {
31public:
33
42 Status addFailPoint(const std::string& name, FailPoint* failPoint);
43
47 FailPoint* getFailPoint(const std::string& name) const;
48
52 void freeze();
53
54private:
55 bool _frozen;
56 unordered_map<std::string, FailPoint*> _fpMap;
57};
58}
Class for storing FailPoint instances.
Definition fail_point_registry.h:30
FailPoint * getFailPoint(const std::string &name) const
Status addFailPoint(const std::string &name, FailPoint *failPoint)
Adds a new fail point to this registry.
void freeze()
Freezes this registry from being modified.
A simple thread-safe fail point implementation that can be activated and deactivated,...
Definition fail_point.h:54
Status represents an error state or the absence thereof.
Definition status.h:50
Utility functions for parsing numbers from strings.
Definition compare_numbers.h:20