Skip to content

Commit

Permalink
Refactor code and delete some useless files.
Browse files Browse the repository at this point in the history
Signed-off-by: vegetableysm <[email protected]>
  • Loading branch information
vegetableysm committed Feb 27, 2024
1 parent 261a0e3 commit 8914d78
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 415 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ endfunction()

file_glob_recurse(FILES_NEED_FORMAT DIRECTORIES "src" "modules" "python" "test" "benchmark"
PATTERNS ".*\\.(cc|cpp|h|hpp|vineyard-mod)$"
EXCLUDE_PATTERNS "(.*\\.vineyard.h$)|(modules/kv-state-cache/radix-tree/radix\.*)"
EXCLUDE_PATTERNS "(.*\\.vineyard.h$)|(modules/kv-state-cache/radix-tree/radix.*)"
)

# the `memcpy.h` is borrowed from external project
Expand Down
1 change: 0 additions & 1 deletion modules/kv-state-cache/ds/kv_state_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ limitations under the License.
#include "common/util/status.h"
#include "kv-state-cache/ds/kv_state_cache_block.h"
#include "kv-state-cache/radix-tree/radix-tree.h"
#include "kv-state-cache/strategy/LRU_strategy.h"

#ifndef MODULES_KV_STATE_CACHE_DS_KV_STATE_CACHE_H_
#define MODULES_KV_STATE_CACHE_DS_KV_STATE_CACHE_H_
Expand Down
4 changes: 2 additions & 2 deletions modules/kv-state-cache/ds/kv_state_cache_block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ void KVStateCacheBlockBuilder::Update(const KV_STATE_WITH_LAYER& kvState,
ACQUIRE_BIT_RESOURCE(this->bitmap[index / 64], index % 64);
}

short KVStateCacheBlockBuilder::Split(KVStateCacheBlockBuilder* child,
int index) {
int16_t KVStateCacheBlockBuilder::Split(KVStateCacheBlockBuilder* child,
int index) {
// TBD
VINEYARD_ASSERT(this->layer == child->layer);
int childIndex = child->FindEmptySlot();
Expand Down
3 changes: 3 additions & 0 deletions modules/kv-state-cache/ds/kv_state_cache_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ limitations under the License.
#include <array>
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "basic/ds/tensor.h"
Expand Down
124 changes: 0 additions & 124 deletions modules/kv-state-cache/strategy/LRU_strategy.cc

This file was deleted.

67 changes: 0 additions & 67 deletions modules/kv-state-cache/strategy/LRU_strategy.h

This file was deleted.

31 changes: 0 additions & 31 deletions modules/kv-state-cache/strategy/cache_strategy.h

This file was deleted.

9 changes: 7 additions & 2 deletions modules/kv-state-cache/utils/kv_state_cache_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ limitations under the License.
*/

#include <cstdlib>
#include <memory>
#include <string>
#include <vector>

#include "client/client.h"
#include "common/util/logging.h"
#include "kv-state-cache/ds/kv_state_cache.h"
#include "kv_state_cache_utils.h"
#include "kv-state-cache/utils/kv_state_cache_utils.h"

using namespace vineyard;
namespace vineyard {

static Client client;
static std::shared_ptr<KVStateCacheBuilder> kvStateCacheBuilder = nullptr;
Expand Down Expand Up @@ -254,3 +257,5 @@ void threadFunc() {
pthread_mutex_unlock(&syncMutex);
}
}

} // namespace vineyard
13 changes: 10 additions & 3 deletions modules/kv-state-cache/utils/kv_state_cache_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

#include <string>
#include <vector>

#include "kv-state-cache/ds/kv_state_cache.h"

#ifndef MODULES_KV_STATE_CACHE_UTILS_H_
#define MODULES_KV_STATE_CACHE_UTILS_H_
#ifndef MODULES_KV_STATE_CACHE_UTILS_KV_STATE_CACHE_UTILS_H_
#define MODULES_KV_STATE_CACHE_UTILS_KV_STATE_CACHE_UTILS_H_

namespace vineyard {

void InitKVStateCache(
int dimension = 10, int cacheCapacity = 10, int layer = 1,
Expand All @@ -37,4 +42,6 @@ void Delete(std::vector<int> token);

void CloseKVStateCache();

#endif
} // namespace vineyard

#endif // MODULES_KV_STATE_CACHE_UTILS_KV_STATE_CACHE_UTILS_H_
5 changes: 1 addition & 4 deletions src/common/util/protocols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2139,8 +2139,7 @@ void WriteInstanceStatusReply(const json& meta, std::string& msg) {

Status ReadInstanceStatusReply(const json& root, json& meta) {
CHECK_IPC_ERROR(root, command_t::INSTANCE_STATUS_REPLY);
meta = root["meta"].get<bool>();
;
meta = root["meta"];
return Status::OK();
}

Expand Down Expand Up @@ -2305,7 +2304,6 @@ void WriteTryReleaseLockRequest(const std::string& key, std::string& msg) {
Status ReadTryReleaseLockRequest(const json& root, std::string& key) {
CHECK_IPC_ERROR(root, command_t::RELEASE_LOCK_REQUEST);
key = root["key"].get<std::string>();
;
return Status::OK();
}

Expand All @@ -2319,7 +2317,6 @@ void WriteTryReleaseLockReply(const bool result, std::string& msg) {
Status ReadTryReleaseLockReply(const json& root, bool& result) {
CHECK_IPC_ERROR(root, command_t::RELEASE_LOCK_REPLY);
result = root["result"].get<bool>();
;
return Status::OK();
}

Expand Down
Loading

0 comments on commit 8914d78

Please sign in to comment.