Skip to content

Commit

Permalink
Remove service types.h
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed Feb 29, 2024
1 parent fe751f3 commit 497d274
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 33 deletions.
12 changes: 8 additions & 4 deletions src/Service/KeeperCommon.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#pragma once

#include <ZooKeeper/ZooKeeperCommon.h>
#include <Common/ThreadPool.h>
#include <libnuraft/nuraft.hxx>

#include <ZooKeeper/ZooKeeperCommon.h>


namespace RK
{

using RunnerId = size_t;
using ThreadPoolPtr = std::shared_ptr<ThreadPool>;

struct RequestId;

/// Attached session id to request
Expand All @@ -22,8 +27,8 @@ struct RequestForSession
int32_t server_id{-1};
int32_t client_id{-1};

// /// RaftKeeper can generate request, for example: sessionCleanerTask
// bool is_internal{false};
// /// RaftKeeper can generate request, for example: sessionCleanerTask
// bool is_internal{false};

explicit RequestForSession() = default;

Expand All @@ -37,7 +42,6 @@ struct RequestForSession

String toString() const;
String toSimpleString() const;

};

/// Attached session id to response
Expand Down
16 changes: 6 additions & 10 deletions src/Service/KeeperServer.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#pragma once

#include <unordered_map>

#include <libnuraft/nuraft.hxx>

#include <Service/Keeper4LWInfo.h>
#include <Service/KeeperCommon.h>
#include <Service/KeeperStore.h>
#include <Service/NuRaftFileLogStore.h>
#include <Service/NuRaftStateMachine.h>
#include <Service/NuRaftStateManager.h>
#include <Service/Settings.h>
#include <Service/Types.h>
#include <libnuraft/nuraft.hxx>

namespace RK
{
Expand Down Expand Up @@ -146,15 +148,9 @@ class KeeperServer

void registerForWardListener(UpdateForwardListener forward_listener);

int32_t myId() const
{
return my_id;
}
int32_t myId() const { return my_id; }

size_t getClusterNodeCount() const
{
return state_manager->getClusterNodeCount();
}
size_t getClusterNodeCount() const { return state_manager->getClusterNodeCount(); }
};

}
17 changes: 10 additions & 7 deletions src/Service/NuRaftStateManager.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#pragma once

#include <fstream>
#include <Service/NuRaftFileLogStore.h>
#include <Service/Settings.h>
#include <Service/Types.h>
#include <libnuraft/buffer.hxx>
#include <libnuraft/nuraft.hxx>

#include <Poco/Util/LayeredConfiguration.h>
#include "Common/StringUtils.h"

#include <Common/StringUtils.h>
#include <common/logger_useful.h>
#include <libnuraft/buffer.hxx>
#include <libnuraft/nuraft.hxx>

#include <Service/KeeperCommon.h>
#include <Service/NuRaftFileLogStore.h>
#include <Service/Settings.h>

namespace RK
{
Expand Down Expand Up @@ -65,7 +68,7 @@ class NuRaftStateManager : public nuraft::state_mgr
//ptr<srv_config> get_srv_config() const { return curr_srv_config; }

ptr<cluster_config> getClusterConfig() const;
void setClusterConfig(const ptr<cluster_config>& new_config);
void setClusterConfig(const ptr<cluster_config> & new_config);

/// Get configuration diff between proposed XML and current state in RAFT
ConfigUpdateActions getConfigurationDiff(const Poco::Util::AbstractConfiguration & config);
Expand Down
2 changes: 1 addition & 1 deletion src/Service/RequestAccumulator.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <Service/KeeperCommon.h>
#include <Service/KeeperServer.h>
#include <Service/RequestProcessor.h>
#include <Service/RequestsQueue.h>
#include <Service/Types.h>

namespace RK
{
Expand Down
2 changes: 1 addition & 1 deletion src/Service/RequestForwarder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <Service/ForwardConnection.h>
#include <Service/ForwardRequest.h>
#include <Service/ForwardResponse.h>
#include <Service/KeeperCommon.h>
#include <Service/KeeperServer.h>
#include <Service/RequestProcessor.h>
#include <Service/RequestsQueue.h>
#include <Service/Types.h>


namespace RK
Expand Down
5 changes: 2 additions & 3 deletions src/Service/RequestProcessor.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include "ZooKeeper/ZooKeeperConstants.h"
#include <Service/KeeperCommon.h>
#include <Service/KeeperServer.h>
#include <Service/RequestsQueue.h>
#include <Service/Types.h>
#include <ZooKeeper/ZooKeeperConstants.h>

namespace RK
Expand Down Expand Up @@ -41,7 +40,7 @@ class RequestProcessor
private:
void run();
/// Exist system for fatal error.
[[noreturn]] static void systemExist() ;
[[noreturn]] static void systemExist();

void moveRequestToPendingQueue(RunnerId runner_id);

Expand Down
7 changes: 0 additions & 7 deletions src/Service/Types.h

This file was deleted.

0 comments on commit 497d274

Please sign in to comment.