add warning flags to cmake
This commit is contained in:
Родитель
85a27b9d03
Коммит
80a1b3853d
|
@ -5,6 +5,12 @@ set(CMAKE_CXX_STANDARD 14)
|
|||
|
||||
add_executable(mock_key_value_store kv_store/src/main.cpp)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(mock_key_value_store PRIVATE /W4)
|
||||
else()
|
||||
target_compile_options(mock_key_value_store PRIVATE -Wall -Wextra -pedantic)
|
||||
endif()
|
||||
|
||||
target_link_libraries(mock_key_value_store mock_kv_store)
|
||||
|
||||
enable_testing()
|
||||
|
|
|
@ -24,6 +24,10 @@ namespace mockdb {
|
|||
this->store = store;
|
||||
}
|
||||
|
||||
virtual ~consistency_checker() {
|
||||
// Pass
|
||||
}
|
||||
|
||||
virtual bool is_consistent(const transaction<K, V> *new_tx) = 0;
|
||||
protected:
|
||||
const kv_store<K, V> *store;
|
||||
|
@ -63,7 +67,7 @@ namespace mockdb {
|
|||
return true;
|
||||
|
||||
// Check if all dependent_txs are committed before tx_id
|
||||
int committed_count = 0;
|
||||
size_t committed_count = 0;
|
||||
for (auto tx : this->store->get_history()) {
|
||||
if (dependent_txs.find(tx->get_tx_id()) != dependent_txs.end())
|
||||
committed_count++;
|
||||
|
|
|
@ -13,9 +13,13 @@ namespace mockdb {
|
|||
virtual K get_key() const {
|
||||
return this->key;
|
||||
}
|
||||
|
||||
virtual ~operation_param() {
|
||||
// Pass
|
||||
}
|
||||
|
||||
protected:
|
||||
K key;
|
||||
|
||||
};
|
||||
|
||||
template <typename K, typename V>
|
||||
|
|
|
@ -10,6 +10,10 @@ namespace mockdb {
|
|||
template <typename K, typename V>
|
||||
class operation_response {
|
||||
public:
|
||||
virtual ~operation_response() {
|
||||
// Pass
|
||||
}
|
||||
|
||||
virtual bool is_successful() {
|
||||
return success;
|
||||
}
|
||||
|
@ -34,8 +38,8 @@ namespace mockdb {
|
|||
long get_written_by_tx_id() const {
|
||||
return written_by_tx_id;
|
||||
}
|
||||
void set_written_by_tx_id(long value) {
|
||||
written_by_tx_id = value;
|
||||
void set_written_by_tx_id(long tx_id) {
|
||||
written_by_tx_id = tx_id;
|
||||
}
|
||||
private:
|
||||
const K key;
|
||||
|
|
|
@ -33,8 +33,8 @@ namespace mockdb {
|
|||
virtual void init_consistency_checker(const kv_store <K, V> *store) = 0;
|
||||
|
||||
// By default it picks one transaction response at random
|
||||
virtual GET_response<K, V> *select_read_response(transaction<K, V> *tx,
|
||||
GET_operation<K, V> *op,
|
||||
virtual GET_response<K, V> *select_read_response(transaction<K, V> *,
|
||||
GET_operation<K, V> *,
|
||||
std::vector<GET_response<K, V> *> candidates) {
|
||||
int idx = std::rand() % candidates.size();
|
||||
return candidates[idx];
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int main() {
|
||||
mockdb::kv_store<std::string, int> *store;
|
||||
mockdb::read_response_selector<std::string, int> *get_next_tx;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче