Skip to content

Commit 5e08ba2

Browse files
committed
Move callbacks impl to callbacks.cc
Move implementation details of classes in Callbacks to a new file callbacks.cc. Similar to previous changes, this reduces the number of files which need to include the implementation details of callbacks.h; specifically item.h which indirectly pulls in a number of header files. Fix up missing / incorrect #includes as a result of this. Change-Id: Icc565894b746e688d0c59a532e7ff98e22683959 Reviewed-on: http://review.couchbase.org/82686 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent e04af9d commit 5e08ba2

File tree

5 files changed

+58
-14
lines changed

5 files changed

+58
-14
lines changed

engines/ep/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ ADD_LIBRARY(ep_objs OBJECT
166166
src/bgfetcher.cc
167167
src/blob.cc
168168
src/bloomfilter.cc
169+
src/callbacks.cc
169170
src/checkpoint.cc
170171
src/checkpoint_remover.cc
171172
src/conflict_resolution.cc

engines/ep/src/callbacks.cc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2+
/*
3+
* Copyright 2017 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+
#include "callbacks.h"
19+
20+
#include "item.h"
21+
22+
GetValue::GetValue()
23+
: id(-1), status(ENGINE_KEY_ENOENT), partial(false), nru(0xff) {
24+
}
25+
GetValue::GetValue(GetValue&& other) = default;
26+
GetValue& GetValue::operator=(GetValue&& other) = default;
27+
28+
GetValue::GetValue(std::unique_ptr<Item> v,
29+
ENGINE_ERROR_CODE s,
30+
uint64_t i,
31+
bool incomplete,
32+
uint8_t _nru)
33+
: item(std::move(v)), id(i), status(s), partial(incomplete), nru(_nru) {
34+
}
35+
36+
GetValue::~GetValue() = default;

engines/ep/src/callbacks.h

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
* limitations under the License.
1616
*/
1717

18-
#ifndef SRC_CALLBACKS_H_
19-
#define SRC_CALLBACKS_H_ 1
18+
#pragma once
2019

2120
#include "config.h"
2221

23-
#include "item.h"
24-
#include "locks.h"
25-
#include "storeddockey.h"
26-
#include "syncobject.h"
27-
#include "utility.h"
22+
#include <memcached/dockey.h>
23+
#include <memcached/engine_error.h>
24+
25+
#include <memory>
2826

2927
class Item;
3028

@@ -51,16 +49,23 @@ class CacheLookup {
5149
*/
5250
class GetValue {
5351
public:
54-
GetValue() : id(-1), status(ENGINE_KEY_ENOENT), partial(false), nru(0xff) {
55-
}
52+
GetValue();
5653

5754
explicit GetValue(std::unique_ptr<Item> v,
5855
ENGINE_ERROR_CODE s = ENGINE_SUCCESS,
5956
uint64_t i = -1,
6057
bool incomplete = false,
61-
uint8_t _nru = 0xff)
62-
: item(std::move(v)), id(i), status(s), partial(incomplete), nru(_nru) {
63-
}
58+
uint8_t _nru = 0xff);
59+
60+
/// Cannot copy GetValues (cannot copy underlying Item).
61+
GetValue(const GetValue&) = delete;
62+
GetValue& operator=(const GetValue&&) = delete;
63+
64+
/// Can move GetValues
65+
GetValue(GetValue&& other);
66+
GetValue& operator=(GetValue&& other);
67+
68+
~GetValue();
6469

6570
/**
6671
* Engine code describing what happened.
@@ -125,5 +130,3 @@ class Callback {
125130

126131
int myStatus;
127132
};
128-
129-
#endif // SRC_CALLBACKS_H_

engines/ep/src/kvstore.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
#include "config.h"
2121

2222
#include "callbacks.h"
23+
#include "storeddockey.h"
2324

25+
#include <memcached/engine_common.h>
26+
#include <memcached/protocol_binary.h>
2427
#include <platform/histogram.h>
2528
#include <platform/processclock.h>
2629

engines/ep/src/warmup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "utility.h"
2424

2525
#include <atomic>
26+
#include <deque>
2627
#include <map>
2728
#include <ostream>
2829
#include <string>

0 commit comments

Comments
 (0)