Improve shared_ptr usage (#2030)

[xray] Improve shared_ptr usage
This commit is contained in:
eric-jj
2018-05-11 20:05:04 -07:00
committed by Philipp Moritz
parent a292d7ba32
commit 71997a481b
26 changed files with 221 additions and 261 deletions
+7 -8
View File
@@ -110,7 +110,7 @@ class ObjectManager {
///
/// \param conn The connection.
/// \return Status of whether the connection was successfully established.
void ProcessNewClient(std::shared_ptr<TcpClientConnection> conn);
void ProcessNewClient(TcpClientConnection &conn);
/// Process messages sent from other nodes. We only establish
/// transfer connections using this method; all other transfer communication
@@ -119,7 +119,7 @@ class ObjectManager {
/// \param conn The connection.
/// \param message_type The message type.
/// \param message A pointer set to the beginning of the message.
void ProcessClientMessage(std::shared_ptr<TcpClientConnection> conn,
void ProcessClientMessage(std::shared_ptr<TcpClientConnection> &conn,
int64_t message_type, const uint8_t *message);
/// Cancels all requests (Push/Pull) associated with the given ObjectID.
@@ -226,7 +226,7 @@ class ObjectManager {
/// Synchronously send a pull request via remote object manager connection.
/// Executes on main_service_ thread.
ray::Status PullSendRequest(const ObjectID &object_id,
std::shared_ptr<SenderConnection> conn);
std::shared_ptr<SenderConnection> &conn);
std::shared_ptr<SenderConnection> CreateSenderConnection(
ConnectionPool::ConnectionType type, RemoteConnectionInfo info);
@@ -241,23 +241,22 @@ class ObjectManager {
/// Executes on send_service_ thread pool.
ray::Status SendObjectHeaders(const ObjectID &object_id, uint64_t data_size,
uint64_t metadata_size, uint64_t chunk_index,
std::shared_ptr<SenderConnection> conn);
std::shared_ptr<SenderConnection> &conn);
/// This method initiates the actual object transfer.
/// Executes on send_service_ thread pool.
ray::Status SendObjectData(const ObjectID &object_id,
const ObjectBufferPool::ChunkInfo &chunk_info,
std::shared_ptr<SenderConnection> conn);
std::shared_ptr<SenderConnection> &conn);
/// Invoked when a remote object manager pushes an object to this object manager.
/// This will invoke the object receive on the receive_service_ thread pool.
void ReceivePushRequest(std::shared_ptr<TcpClientConnection> conn,
void ReceivePushRequest(std::shared_ptr<TcpClientConnection> &conn,
const uint8_t *message);
/// Execute a receive on the receive_service_ thread pool.
void ExecuteReceiveObject(const ClientID &client_id, const ObjectID &object_id,
uint64_t data_size, uint64_t metadata_size,
uint64_t chunk_index,
std::shared_ptr<TcpClientConnection> conn);
uint64_t chunk_index, TcpClientConnection &conn);
/// Handles receiving a pull request message.
void ReceivePullRequest(std::shared_ptr<TcpClientConnection> &conn,