1 /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
3 * Copyright 2017 Couchbase, Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 #include <ep_bucket.h>
21 #include <ep_engine.h>
23 /* A class which subclasses the real EPEngine. Its main purpose is to allow
24 * us to construct and setup an EPStore without starting all the various
25 * background tasks which are normally started by EPEngine as part of creating
26 * EPStore (in the initialize() method).
28 * The net result is a (mostly) synchronous environment - while the
29 * ExecutorPool's threads exist, none of the normally-created background Tasks
30 * should be running. Note however that /if/ any new tasks are created, they
31 * will be scheduled on the ExecutorPools' threads asynchronously.
33 class SynchronousEPEngine : public EventuallyPersistentEngine {
35 SynchronousEPEngine(const std::string& extra_config);
37 void setKVBucket(std::unique_ptr<KVBucket> store);
39 /* Allow us to call normally protected methods */
41 ENGINE_ERROR_CODE public_doTapVbTakeoverStats(const void* cookie,
45 return doTapVbTakeoverStats(cookie, add_stat, key, vbid);
48 ENGINE_ERROR_CODE public_doDcpVbTakeoverStats(const void* cookie,
52 return doDcpVbTakeoverStats(cookie, add_stat, key, vbid);
55 void public_initializeEngineCallbacks() {
56 return initializeEngineCallbacks();
60 * Initialize the connmap objects, which creates tasks
61 * so must be done after executorpool is created
63 void initializeConnmaps();
65 std::unique_ptr<KVBucket> public_makeBucket(Configuration& config) {
66 return makeBucket(config);