Repository: ray-project/ray
File: src/ray/raylet/node_manager.h (C/C++)

Code before:
  /// Cleanup any lease resources and state for a worker that was granted a lease.
  ///
  /// \param worker The worker that was granted the lease.
  /// \return Whether the worker should be returned to the idle pool. This is
  /// only false for actor creation calls, which should never be returned to idle.
  bool CleanupLease(const std::shared_ptr<WorkerInterface> &worker);

  /// Convert a worker to an actor since it's finished an actor creation task.
  /// \param worker The worker that was granted the actor creation lease.
  /// \param lease The lease of the actor creation task.
  void ConvertWorkerToActor(const std::shared_ptr<WorkerInterface> &worker,
                            const RayLease &lease);

  /// Start a wait request for the requested objects.
  ///
  /// \param client The client that is requesting the objects.
  /// \param object_refs The objects that are requested.
  void AsyncWait(const std::shared_ptr<ClientConnection> &client,
                 const std::vector<rpc::ObjectReference> &object_refs);

  /// Start a get request for the requested objects.
  ///
  /// \param client The client that is requesting the objects.
  /// \param object_refs The objects that are requested.
  ///
  /// \param get_request_id The ID of the get request.
  void AsyncGet(const std::shared_ptr<ClientConnection> &client,
                std::vector<rpc::ObjectReference> &object_refs,
                int64_t get_request_id);

  /// Cancel all ongoing get requests from the client.
  ///
  /// This does *not* cancel ongoing wait requests.
  ///
  /// \param client The client whose get requests will be canceled.
  void CancelGetRequest(const std::shared_ptr<ClientConnection> &client,
                        const uint8_t *message_data);

  /// Handle a task that is blocked. Note that this callback may
  /// arrive after the worker lease has been returned to the node manager.
  ///
  /// \param worker Shared ptr to the worker, or nullptr if lost.
  void HandleNotifyWorkerBlocked(const std::shared_ptr<WorkerInterface> &worker);

  /// Handle a task that is unblocked. Note that this callback may
  /// arrive after the worker lease has been returned to the node manager.
  /// However, it is guaranteed to arrive after DirectCallTaskBlocked.
  ///
  /// \param worker Shared ptr to the worker, or nullptr if lost.
  void HandleNotifyWorkerUnblocked(const std::shared_ptr<WorkerInterface> &worker);


Review comment (refactor):
```suggestion
  /// \param get_request_id The ID of the get request. It is used by the worker to clean up a GetRequest.
```

Code after:
  /// Cleanup any lease resources and state for a worker that was granted a lease.
  ///
  /// \param worker The worker that was granted the lease.
  /// \return Whether the worker should be returned to the idle pool. This is
  /// only false for actor creation calls, which should never be returned to idle.
  bool CleanupLease(const std::shared_ptr<WorkerInterface> &worker);

  /// Convert a worker to an actor since it's finished an actor creation task.
  /// \param worker The worker that was granted the actor creation lease.
  /// \param lease The lease of the actor creation task.
  void ConvertWorkerToActor(const std::shared_ptr<WorkerInterface> &worker,
                            const RayLease &lease);

  /// Start a wait request for the requested objects.
  ///
  /// \param client The client that is requesting the objects.
  /// \param object_refs The objects that are requested.
  void AsyncWait(const std::shared_ptr<ClientConnection> &client,
                 const std::vector<rpc::ObjectReference> &object_refs);

  /// Start a get request for the requested objects.
  ///
  /// \param client The client that is requesting the objects.
  /// \param object_refs The objects that are requested.
  ///
  /// \param get_request_id The ID of the get request. It is used by the worker to clean
  /// up a GetRequest.
  void AsyncGet(const std::shared_ptr<ClientConnection> &client,
                std::vector<rpc::ObjectReference> &object_refs,
                int64_t get_request_id);

  /// Cancel all ongoing get requests from the client.
  ///
  /// This does *not* cancel ongoing wait requests.
  ///
  /// \param client The client whose get requests will be canceled.
  void CancelGetRequest(const std::shared_ptr<ClientConnection> &client,
                        const uint8_t *message_data);

  /// Handle a task that is blocked. Note that this callback may
  /// arrive after the worker lease has been returned to the node manager.
  ///
  /// \param worker Shared ptr to the worker, or nullptr if lost.
  void HandleNotifyWorkerBlocked(const std::shared_ptr<WorkerInterface> &worker);

  /// Handle a task that is unblocked. Note that this callback may
  /// arrive after the worker lease has been returned to the node manager.
  /// However, it is guaranteed to arrive after DirectCallTaskBlocked.
  ///
  /// \param worker Shared ptr to the worker, or nullptr if lost.
  void HandleNotifyWorkerUnblocked(const std::shared_ptr<WorkerInterface> &worker);