Skip to content

Commit

Permalink
modify according to comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahashen committed Oct 17, 2024
1 parent a36d8b9 commit 851e3dd
Show file tree
Hide file tree
Showing 49 changed files with 81 additions and 363 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ INCLUDE(cmake/brpc.cmake)
INCLUDE(cmake/rocksdb.cmake)
INCLUDE(cmake/braft.cmake)
INCLUDE(cmake/rediscache.cmake)
INCLUDE(cmake/jemalloc.cmake)

SET(PROTO_OUTPUT_DIR "${CMAKE_BINARY_DIR}/generated_pb")
FILE(MAKE_DIRECTORY "${PROTO_OUTPUT_DIR}")
Expand Down
41 changes: 0 additions & 41 deletions cmake/jemalloc.cmake

This file was deleted.

9 changes: 2 additions & 7 deletions cmake/rediscache.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.

SET(REDISCACHE_SOURCES_DIR "${LIB_INSTALL_PREFIX}" CACHE PATH "rediscache source directory." FORCE)
SET(REDISCACHE_INSTALL_DIR "${LIB_INSTALL_PREFIX}" CACHE PATH "rediscache install directory." FORCE)
SET(REDISCACHE_SOURCES_DIR "${LIB_INSTALL_PREFIX}" CACHE PATH "rediscache source directory.")
SET(REDISCACHE_INSTALL_DIR "${LIB_INSTALL_PREFIX}" CACHE PATH "rediscache install directory.")
SET(REDISCACHE_INCLUDE_DIR "${LIB_INCLUDE_DIR}" CACHE PATH "rediscache include directory." FORCE)
SET(REDISCACHE_LIBRARIES "${LIB_INSTALL_DIR}/librediscache.a" CACHE FILEPATH "rediscache library." FORCE)

Expand Down
6 changes: 1 addition & 5 deletions src/base_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include "common.h"
#include "config.h"
#include "log.h"
#include "kiwi.h"
#include "log.h"
#include "praft/praft.h"

namespace kiwi {
Expand Down Expand Up @@ -96,10 +96,6 @@ bool BaseCmd::IsNeedReadCache() const { return HasFlag(kCmdFlagsReadCache); }
bool BaseCmd::IsNeedUpdateCache() const { return HasFlag(kCmdFlagsUpdateCache); }

bool BaseCmd::IsNeedCacheDo(PClient* client) const {
if (g_config.tmp_cache_disable_flag.load()) {
return false;
}

if (HasFlag(kCmdFlagsKv)) {
if (!g_config.cache_string.load()) {
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/base_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ class BaseCmd : public std::enable_shared_from_this<BaseCmd> {
uint32_t cmd_id_ = 0;
uint32_t acl_category_ = 0;

// save db operation status which will be used in cache operation
storage::Status s_;

private:
// The function to be executed first before executing `DoCmd`
// What needs to be done at present are: extract the key in the command and fill it into the context
Expand Down
5 changes: 0 additions & 5 deletions src/cache/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.

FILE(GLOB PCACHE_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cc"
Expand Down
5 changes: 0 additions & 5 deletions src/cache/config.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once

#include <cstdint>
Expand Down
5 changes: 0 additions & 5 deletions src/cache/hash.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#include "pstd_defer.h"
#include "redisCache.h"

Expand Down
5 changes: 0 additions & 5 deletions src/cache/list.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#include "pstd_defer.h"
#include "redisCache.h"

Expand Down
5 changes: 0 additions & 5 deletions src/cache/redisCache.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#include "cache/redisCache.h"
#include "pstd/pstd_defer.h"
#include "pstd/pstd_string.h"
Expand Down
5 changes: 0 additions & 5 deletions src/cache/redisCache.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once

#include <unistd.h>
Expand Down
5 changes: 0 additions & 5 deletions src/cache/set.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#include "pstd_defer.h"
#include "redisCache.h"

Expand Down
5 changes: 0 additions & 5 deletions src/cache/string.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#include <cstdlib>

#include "pstd/pstd_defer.h"
Expand Down
5 changes: 0 additions & 5 deletions src/cache/zset.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#include "pstd/pstd_defer.h"
#include "redisCache.h"

Expand Down
5 changes: 0 additions & 5 deletions src/cache_define.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// Copyright (c) 2024-present, Qihoo, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once

namespace kiwi {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd_admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CmdConfig : public BaseCmdGroup {
private:
// std::vector<std::string> subCmd_;

void DoCmd(PClient* client) override{};
void DoCmd(PClient* client) override {};
};

class CmdConfigGet : public BaseCmd {
Expand Down Expand Up @@ -178,7 +178,7 @@ class CmdDebug : public BaseCmdGroup {
bool DoInitial(PClient* client) override { return true; };

private:
void DoCmd(PClient* client) override{};
void DoCmd(PClient* client) override {};
};

class CmdDebugHelp : public BaseCmd {
Expand Down
16 changes: 2 additions & 14 deletions src/cmd_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class HSetCmd : public BaseCmd {
void DoCmd(PClient *client) override;
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
storage::Status s_;
};

class HGetCmd : public BaseCmd {
Expand All @@ -41,7 +40,6 @@ class HGetCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
storage::Status s_;
};

class HDelCmd : public BaseCmd {
Expand All @@ -55,7 +53,7 @@ class HDelCmd : public BaseCmd {
void DoCmd(PClient *client) override;
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
rocksdb::Status s_;

int32_t deleted_ = 0;
};

Expand All @@ -70,7 +68,6 @@ class HMSetCmd : public BaseCmd {
void DoCmd(PClient *client) override;
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
rocksdb::Status s_;
};

class HMGetCmd : public BaseCmd {
Expand All @@ -85,7 +82,6 @@ class HMGetCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
rocksdb::Status s_;
};

class HGetAllCmd : public BaseCmd {
Expand All @@ -100,7 +96,6 @@ class HGetAllCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
rocksdb::Status s_;
};

class HKeysCmd : public BaseCmd {
Expand All @@ -115,7 +110,6 @@ class HKeysCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
rocksdb::Status s_;
};

class HLenCmd : public BaseCmd {
Expand All @@ -130,7 +124,6 @@ class HLenCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
rocksdb::Status s_;
};

class HStrLenCmd : public BaseCmd {
Expand All @@ -145,7 +138,6 @@ class HStrLenCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
storage::Status s_;
};

class HScanCmd : public BaseCmd {
Expand Down Expand Up @@ -174,7 +166,6 @@ class HValsCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
storage::Status s_;
};

class HIncrbyFloatCmd : public BaseCmd {
Expand All @@ -188,7 +179,6 @@ class HIncrbyFloatCmd : public BaseCmd {
void DoCmd(PClient *client) override;
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
storage::Status s_;
};

class HSetNXCmd : public BaseCmd {
Expand All @@ -202,7 +192,6 @@ class HSetNXCmd : public BaseCmd {
void DoCmd(PClient *client) override;
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
storage::Status s_;
};

class HIncrbyCmd : public BaseCmd {
Expand All @@ -216,7 +205,7 @@ class HIncrbyCmd : public BaseCmd {
void DoCmd(PClient *client) override;
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
storage::Status s_;

int64_t int_by_ = 0;
};

Expand Down Expand Up @@ -244,7 +233,6 @@ class HExistsCmd : public BaseCmd {
void DoThroughDB(PClient *client) override;
void DoUpdateCache(PClient *client) override;
void ReadCache(PClient *client) override;
rocksdb::Status s_;
};

} // namespace kiwi
8 changes: 2 additions & 6 deletions src/cmd_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class DelCmd : public BaseCmd {
bool DoInitial(PClient* client) override;

private:
rocksdb::Status s_;
void DoCmd(PClient* client) override;
void DoThroughDB(PClient* client) override;
void DoUpdateCache(PClient* client) override;
Expand Down Expand Up @@ -65,7 +64,7 @@ class ExpireCmd : public BaseCmd {
void DoCmd(PClient* client) override;
void DoThroughDB(PClient* client) override;
void DoUpdateCache(PClient* client) override;
rocksdb::Status s_;

int64_t sec_ = 0;
};

Expand Down Expand Up @@ -94,7 +93,6 @@ class PExpireCmd : public BaseCmd {
void DoThroughDB(PClient* client) override;
void DoUpdateCache(PClient* client) override;
int64_t msec_ = 0;
rocksdb::Status s_;
};

class ExpireatCmd : public BaseCmd {
Expand All @@ -105,7 +103,6 @@ class ExpireatCmd : public BaseCmd {
bool DoInitial(PClient* client) override;

private:
rocksdb::Status s_;
int64_t time_stamp_ = 0;
void DoCmd(PClient* client) override;
void DoThroughDB(PClient* client) override;
Expand All @@ -120,7 +117,6 @@ class PExpireatCmd : public BaseCmd {
bool DoInitial(PClient* client) override;

private:
rocksdb::Status s_;
int64_t time_stamp_ms_ = 0;
void DoCmd(PClient* client) override;
void DoThroughDB(PClient* client) override;
Expand All @@ -136,7 +132,7 @@ class PersistCmd : public BaseCmd {

private:
void DoCmd(PClient* client) override;
rocksdb::Status s_;

void DoThroughDB(PClient* client) override;
void DoUpdateCache(PClient* client) override;
};
Expand Down
2 changes: 0 additions & 2 deletions src/cmd_kv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,6 @@ bool SetRangeCmd::DoInitial(PClient* client) {
}

void SetRangeCmd::DoCmd(PClient* client) {


int32_t ret = 0;
s_ =
PSTORE.GetBackend(client->GetCurrentDB())->GetStorage()->Setrange(client->Key(), offset_, client->argv_[3], &ret);
Expand Down
Loading

0 comments on commit 851e3dd

Please sign in to comment.