Skip to content

Commit

Permalink
Fix typo ReadBufferFromNuRaftBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed Feb 20, 2024
1 parent 1afb578 commit 900a1e9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
13 changes: 8 additions & 5 deletions src/Service/KeeperServer.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#include <chrono>
#include <string>

#include <Poco/NumberFormatter.h>

#include <Common/Stopwatch.h>
#include <libnuraft/async.hxx>

#include <Service/KeeperServer.h>
#include <Service/LoggerWrapper.h>
#include <Service/NuRaftStateMachine.h>
#include <Service/NuRaftStateManager.h>
#include <Service/ReadBufferFromNuraftBuffer.h>
#include <Service/ReadBufferFromNuRaftBuffer.h>
#include <ZooKeeper/ZooKeeperIO.h>
#include <libnuraft/async.hxx>
#include <Poco/NumberFormatter.h>
#include <Common/Stopwatch.h>

namespace RK
{
Expand Down Expand Up @@ -205,7 +208,7 @@ bool KeeperServer::updateSessionTimeout(int64_t session_id, int64_t session_time
if (!result->get())
throw Exception(ErrorCodes::RAFT_ERROR, "Received nullptr when updating session timeout");

auto buffer = ReadBufferFromNuraftBuffer(*result->get());
auto buffer = ReadBufferFromNuRaftBuffer(*result->get());
int8_t is_success;
Coordination::read(is_success, buffer);

Expand Down
10 changes: 5 additions & 5 deletions src/Service/NuRaftLogSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <Service/KeeperUtils.h>
#include <Service/NuRaftLogSnapshot.h>
#include <Service/ReadBufferFromNuraftBuffer.h>
#include <Service/ReadBufferFromNuRaftBuffer.h>
#include <Service/WriteBufferFromNuraftBuffer.h>
#include <ZooKeeper/ZooKeeperIO.h>

Expand Down Expand Up @@ -710,7 +710,7 @@ bool KeeperSnapshotStore::parseObject(String obj_path, KeeperStore & store)
//buf->put(data.data(), data.size());
buf->put(data);
buf->pos(0);
ReadBufferFromNuraftBuffer in(buf);
ReadBufferFromNuRaftBuffer in(buf);
ptr<KeeperNode> node = cs_new<KeeperNode>();
String key;
try
Expand Down Expand Up @@ -778,7 +778,7 @@ bool KeeperSnapshotStore::parseObject(String obj_path, KeeperStore & store)
ptr<buffer> buf = buffer::alloc(data.size() + 1);
buf->put(data);
buf->pos(0);
ReadBufferFromNuraftBuffer in(buf);
ReadBufferFromNuRaftBuffer in(buf);
int64_t session_id;
int64_t timeout;
try
Expand Down Expand Up @@ -823,7 +823,7 @@ bool KeeperSnapshotStore::parseObject(String obj_path, KeeperStore & store)
ptr<buffer> buf = buffer::alloc(data.size() + 1);
buf->put(data);
buf->pos(0);
ReadBufferFromNuraftBuffer in(buf);
ReadBufferFromNuRaftBuffer in(buf);

uint64_t acl_id;
Coordination::ACLs acls;
Expand All @@ -845,7 +845,7 @@ bool KeeperSnapshotStore::parseObject(String obj_path, KeeperStore & store)
ptr<buffer> buf = buffer::alloc(data.size() + 1);
buf->put(data);
buf->pos(0);
ReadBufferFromNuraftBuffer in(buf);
ReadBufferFromNuRaftBuffer in(buf);
String key;
int64_t value;
try
Expand Down
6 changes: 3 additions & 3 deletions src/Service/NuRaftStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <Service/NuRaftFileLogStore.h>
#include <Service/NuRaftStateMachine.h>
#include <Service/ReadBufferFromNuraftBuffer.h>
#include <Service/ReadBufferFromNuRaftBuffer.h>
#include <Service/RequestProcessor.h>
#include <Service/ThreadSafeQueue.h>
#include <Service/WriteBufferFromNuraftBuffer.h>
Expand Down Expand Up @@ -104,7 +104,7 @@ ptr<RequestForSession> NuRaftStateMachine::createRequestSession(ptr<log_entry> &
if (entry->get_val_type() != nuraft::log_val_type::app_log)
return nullptr;

ReadBufferFromNuraftBuffer buffer(entry->get_buf());
ReadBufferFromNuRaftBuffer buffer(entry->get_buf());
ptr<RequestForSession> request_for_session = cs_new<RequestForSession>();

readIntBinary(request_for_session->session_id, buffer);
Expand Down Expand Up @@ -178,7 +178,7 @@ void NuRaftStateMachine::snapThread()

RequestForSession NuRaftStateMachine::parseRequest(nuraft::buffer & data)
{
ReadBufferFromNuraftBuffer buffer(data);
ReadBufferFromNuRaftBuffer buffer(data);
RequestForSession request_for_session;
/// TODO unify digital encoding mode
readIntBinary(request_for_session.session_id, buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
namespace RK
{

class ReadBufferFromNuraftBuffer : public ReadBufferFromMemory
class ReadBufferFromNuRaftBuffer : public ReadBufferFromMemory
{
public:
explicit ReadBufferFromNuraftBuffer(nuraft::ptr<nuraft::buffer> buffer) : ReadBufferFromMemory(buffer->data_begin(), buffer->size()) { }
explicit ReadBufferFromNuraftBuffer(nuraft::buffer & buffer) : ReadBufferFromMemory(buffer.data_begin(), buffer.size()) { }
explicit ReadBufferFromNuRaftBuffer(nuraft::ptr<nuraft::buffer> buffer) : ReadBufferFromMemory(buffer->data_begin(), buffer->size()) { }
explicit ReadBufferFromNuRaftBuffer(nuraft::buffer & buffer) : ReadBufferFromMemory(buffer.data_begin(), buffer.size()) { }
};

}

0 comments on commit 900a1e9

Please sign in to comment.