Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix ci check format failed #443

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pikiwidb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- name: Check Format
working-directory: ${{ github.workspace }}/build
run: clang-format --version
run: make check-format

build_on_macos:
runs-on: macos-latest
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
2 changes: 1 addition & 1 deletion src/net/base_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class BaseEvent : public std::enable_shared_from_this<BaseEvent> {
const static int EVENT_HUB;

BaseEvent(const std::shared_ptr<NetEvent> &listen, int8_t mode, int8_t type)
: listen_(listen), mode_(mode), type_(type) {};
: listen_(listen), mode_(mode), type_(type){};

virtual ~BaseEvent() = default;

Expand Down
2 changes: 1 addition & 1 deletion src/net/base_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BaseSocket : public NetEvent {

~BaseSocket() override = default;

void OnError() override {};
void OnError() override{};

void Close() override;

Expand Down
3 changes: 2 additions & 1 deletion src/net/callback_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ concept HasSetFdFunction = requires(T t, uint64_t id, int8_t index) {
{ (*t).GetConnId() } -> std::same_as<uint64_t>; // GetFd return type is int
{ (*t).SetThreadIndex(index) } -> std::same_as<void>; // SetThreadIndex return type is void
{ (*t).GetThreadIndex() } -> std::same_as<int8_t>; // GetThreadIndex return type is int8_t
} || std::is_class_v<T>; // If T is an ordinary class, the member function is called directly
}
|| std::is_class_v<T>; // If T is an ordinary class, the member function is called directly

template <typename T>
requires HasSetFdFunction<T>
Expand Down
2 changes: 1 addition & 1 deletion src/net/client_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace net {

class ClientSocket : public StreamSocket {
public:
explicit ClientSocket(const SocketAddr& addr) : StreamSocket(0, SOCKET_TCP), addr_(addr) {};
explicit ClientSocket(const SocketAddr& addr) : StreamSocket(0, SOCKET_TCP), addr_(addr){};

~ClientSocket() override = default;

Expand Down
2 changes: 1 addition & 1 deletion src/net/epoll_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace net {
class EpollEvent : public BaseEvent {
public:
explicit EpollEvent(const std::shared_ptr<NetEvent> &listen, int8_t mode)
: BaseEvent(listen, mode, BaseEvent::EVENT_TYPE_EPOLL) {};
: BaseEvent(listen, mode, BaseEvent::EVENT_TYPE_EPOLL){};

~EpollEvent() override { Close(); }

Expand Down
6 changes: 2 additions & 4 deletions src/net/event_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ class EventServer final {
};

template <typename T>
requires HasSetFdFunction<T>
std::pair<bool, std::string> EventServer<T>::StartServer(int64_t interval) {
requires HasSetFdFunction<T> std::pair<bool, std::string> EventServer<T>::StartServer(int64_t interval) {
if (threadNum_ <= 0) {
return std::pair(false, "thread num must be greater than 0");
}
Expand Down Expand Up @@ -144,8 +143,7 @@ std::pair<bool, std::string> EventServer<T>::StartServer(int64_t interval) {
}

template <typename T>
requires HasSetFdFunction<T>
std::pair<bool, std::string> EventServer<T>::StartClientServer() {
requires HasSetFdFunction<T> std::pair<bool, std::string> EventServer<T>::StartClientServer() {
if (threadNum_ <= 0) {
return std::pair(false, "thread num must be greater than 0");
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/io_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace net {

class IOThread {
public:
explicit IOThread(const std::shared_ptr<BaseEvent> &event) : baseEvent_(event) {};
explicit IOThread(const std::shared_ptr<BaseEvent> &event) : baseEvent_(event){};

~IOThread() = default;

Expand Down
2 changes: 1 addition & 1 deletion src/net/kqueue_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace net {
class KqueueEvent : public BaseEvent {
public:
explicit KqueueEvent(std::shared_ptr<NetEvent> listen, int8_t mode)
: BaseEvent(std::move(listen), mode, BaseEvent::EVENT_TYPE_KQUEUE) {};
: BaseEvent(std::move(listen), mode, BaseEvent::EVENT_TYPE_KQUEUE){};

~KqueueEvent() override { Close(); }

Expand Down
13 changes: 4 additions & 9 deletions src/net/thread_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ class ThreadManager {
};

template <typename T>
requires HasSetFdFunction<T>
ThreadManager<T>::~ThreadManager() {
Stop();
}
requires HasSetFdFunction<T> ThreadManager<T>::~ThreadManager() { Stop(); }

template <typename T>
requires HasSetFdFunction<T>
Expand Down Expand Up @@ -204,9 +201,7 @@ void ThreadManager<T>::OnNetEventClose(uint64_t connId, std::string &&err) {

template <typename T>
requires HasSetFdFunction<T>
void ThreadManager<T>::CloseConnection(uint64_t connId) {
OnNetEventClose(connId, "");
}
void ThreadManager<T>::CloseConnection(uint64_t connId) { OnNetEventClose(connId, ""); }

template <typename T>
requires HasSetFdFunction<T>
Expand Down Expand Up @@ -331,8 +326,8 @@ bool ThreadManager<T>::CreateWriteThread() {
}

template <typename T>
requires HasSetFdFunction<T>
uint64_t ThreadManager<T>::DoTCPConnect(T &t, int fd, const std::shared_ptr<Connection> &conn) {
requires HasSetFdFunction<T> uint64_t ThreadManager<T>::DoTCPConnect(T &t, int fd,
const std::shared_ptr<Connection> &conn) {
auto connId = getConnId();
if constexpr (IsPointer_v<T>) {
t->SetConnId(connId);
Expand Down
2 changes: 1 addition & 1 deletion src/storage/src/base_data_value_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ParsedBaseDataValue : public ParsedInternalValue {
}

protected:
virtual void SetVersionToValue() override {};
virtual void SetVersionToValue() override{};

private:
const size_t kBaseDataValueSuffixLength = kSuffixReserveLength + kTimestampLength;
Expand Down
Loading