Skip to content

Commit

Permalink
feat: Add comment & delete unused file & improve user command process…
Browse files Browse the repository at this point in the history
…ing logic (#435)

* Imporve the CMakeLists.txt

* update url_hash for all the extern library

* Remove outdated and useless files, add appropriate comments, and improve certain logic to enhance readability

---------

Co-authored-by: Wen Yi <[email protected]>
Co-authored-by: Xin.Zh <[email protected]>
Co-authored-by: 文一 <[email protected]>
  • Loading branch information
4 people committed Aug 26, 2024
1 parent 753b7a1 commit 1b2b016
Show file tree
Hide file tree
Showing 57 changed files with 748 additions and 1,005 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Pikiwidb is compiled by default in release mode, which does not support debuggin
## Run

```bash
bin/pikiwidb etc/conf/pikiwidb.conf
./bin/pikiwidb ./etc/conf/pikiwidb.conf
```

## Support module for write your own extensions
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PikiwiDB 默认以 release 模式编译,不支持调试。如果需要调试
## 运行

```bash
bin/pikiwidb etc/conf/pikiwidb.conf
./bin/pikiwidb ./etc/conf/pikiwidb.conf
```

## 与 Redis 完全兼容
Expand Down
13 changes: 8 additions & 5 deletions src/base_cmd.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
*/
Built the foundational classes for the design and expansion of commands.
*/

#include "base_cmd.h"

Expand Down Expand Up @@ -114,3 +116,4 @@ bool BaseCmdGroup::DoInitial(PClient* client) {
}

} // namespace pikiwidb
/* namespace pikiwidb */
10 changes: 6 additions & 4 deletions src/base_cmd.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined the open commands of PikiwiDB to the outside, the setting of permissions, and other aspects.
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/client.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Implemented a set of functions for interfacing with the client.
*/

#include "client.h"
Expand Down
11 changes: 7 additions & 4 deletions src/client.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined a set of feedback codes, messages, and functions
related to handling client commands.
*/

#pragma once
Expand Down
15 changes: 11 additions & 4 deletions src/cmd_admin.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Many management-level commands are defined here.
Compared to the external commands at the user level,
the commands defined here are more focused on the overall
management of the PikiwiDB.
*/

#include <sys/resource.h>
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_admin.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Stores the declarations of management commands.
*/

#pragma once
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_hash.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined a set of functions for operating key-value pairs
in a hash table.
*/
#include "cmd_hash.h"

Expand Down
11 changes: 7 additions & 4 deletions src/cmd_hash.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Declared a set of functions for operating key-value pairs
in a hash table, which can be understood with reference to the principles of Redis HSET and other commands.
*/

#pragma once
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_keys.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
This file implements commands that focus on the keys in
key-value pairs, rather than the values.
*/

#include "cmd_keys.h"
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_keys.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
This file defines some functions and commands related
to key operations.
*/

#pragma once
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_kv.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Implemented a set of operation functions and commands
associated with key-value pairs.
*/

#include "cmd_kv.h"
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_kv.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined a set of operation functions and commands related
to key-value pairs.
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_list.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Implemented a set of operation functions and commands related to lists.
*/

#include "cmd_list.h"
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_list.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined a set of operation functions and commands related to lists.
*/

#pragma once
Expand Down
13 changes: 9 additions & 4 deletions src/cmd_raft.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
A set of instructions and functions related to Raft.
Defined a set of functions and instructions related to the
implementation of Raft, which is key to the distributed cluster implementation of PikiwiDB.
*/

#include "cmd_raft.h"
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_raft.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
The declarations of a set of instructions and functions
related to Raft are written here.
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_set.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
A set of instructions and functions related to set operations.
*/

#include "cmd_set.h"
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_set.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Declarations of a set of instructions and functions related
to set operations.
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_table_manager.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined a command table for managing the commands themselves.
*/

#include "cmd_table_manager.h"
Expand Down
11 changes: 7 additions & 4 deletions src/cmd_table_manager.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Defined a command table, because PikiwiDB needs to manage
commands in an integrated way.
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_thread_pool.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
A thread pool for managing commands has been implemented.
*/

#include "cmd_thread_pool.h"
Expand Down
13 changes: 9 additions & 4 deletions src/cmd_thread_pool.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
A thread pool for managing commands has been defined here.
*/

#pragma once
Expand All @@ -21,6 +23,9 @@ namespace pikiwidb {
// task interface
// inherit this class and implement the Run method
// then submit the task to the thread pool
/*
CmdThreadPoolTask
*/
class CmdThreadPoolTask {
public:
explicit CmdThreadPoolTask(std::shared_ptr<PClient> client) : client_(std::move(client)) {}
Expand Down
10 changes: 6 additions & 4 deletions src/cmd_thread_pool_worker.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2023-present, OpenAtom Foundation, 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

/*
* Copyright (c) 2023-present, OpenAtom Foundation, 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.
Retrieve commands from the thread pool and execute them.
*/

#include "cmd_thread_pool_worker.h"
Expand Down
Loading

0 comments on commit 1b2b016

Please sign in to comment.