1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 *     Copyright 2018 Couchbase, Inc.
4 *
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
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
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.
16 */
17
18#pragma once
19
20#include "ep_bucket.h"
21
22class MockItemFreqDecayerTask;
23
24/*
25 * Mock of the EPBucket class.
26 */
27class MockEPBucket : public EPBucket {
28public:
29    MockEPBucket(EventuallyPersistentEngine& theEngine) : EPBucket(theEngine) {
30    }
31
32    void createItemFreqDecayerTask();
33
34    void disableItemFreqDecayerTask();
35
36    MockItemFreqDecayerTask* getMockItemFreqDecayerTask();
37
38    VBucketPtr makeVBucket(Vbid id,
39                           vbucket_state_t state,
40                           KVShard* shard,
41                           std::unique_ptr<FailoverTable> table,
42                           NewSeqnoCallback newSeqnoCb,
43                           std::unique_ptr<Collections::VB::Manifest> manifest,
44                           vbucket_state_t initState,
45                           int64_t lastSeqno,
46                           uint64_t lastSnapStart,
47                           uint64_t lastSnapEnd,
48                           uint64_t purgeSeqno,
49                           uint64_t maxCas,
50                           int64_t hlcEpochSeqno,
51                           bool mightContainXattrs,
52                           const nlohmann::json& replicationTopology,
53                           uint64_t maxVisibleSeqno) override;
54
55    void setDurabilityCompletionTask(
56            std::shared_ptr<DurabilityCompletionTask> task);
57
58    /// @returns a non-const pointer to Flusher object.
59    Flusher* getFlusherNonConst(Vbid vbid);
60};
61