Repository: envoyproxy/envoy
File: envoy/stream_info/stream_info.h (C/C++)

Code before:

  /**
   * @param failure_reason the upstream transport failure reason.
   */
  virtual void setUpstreamTransportFailureReason(absl::string_view failure_reason) PURE;

  /**
   * @return const std::string& the upstream transport failure reason, e.g. certificate validation
   *         failed.
   */
  virtual const std::string& upstreamTransportFailureReason() const PURE;

  /**
   * @param close_type the upstream detected close type.
   */
  virtual void setUpstreamDetectedCloseType(DetectedCloseType close_type) PURE;

  /**
   * @return StreamInfo::DetectedCloseType the upstream detected close type.
   */
  virtual DetectedCloseType upstreamDetectedCloseType() const PURE;

  /**
   * @param failure_reason the upstream local close reason.
   */
  virtual void setUpstreamLocalCloseReason(absl::string_view failure_reason) PURE;

  /**
   * @return absl::string_view the upstream local close reason, if local close did not occur an
   * empty string view is returned.
   */
  virtual absl::string_view upstreamLocalCloseReason() const PURE;

  /**
   * @param host the selected upstream host for the request.
   */
  virtual void setUpstreamHost(Upstream::HostDescriptionConstSharedPtr host) PURE;

  /**
   * @return upstream host description.
   */
  virtual Upstream::HostDescriptionConstSharedPtr upstreamHost() const PURE;

  /**
   * Filter State object to be shared between upstream and downstream filters.
   * @param pointer to upstream connections filter state.
   * @return pointer to filter state to be used by upstream connections.
   */
  virtual const FilterStateSharedPtr& upstreamFilterState() const PURE;
  virtual void setUpstreamFilterState(const FilterStateSharedPtr& filter_state) PURE;


Review comment (bug):
using `reason` is better here, it is not necessarily a failure.

Code after:

  /**
   * @param failure_reason the upstream transport failure reason.
   */
  virtual void setUpstreamTransportFailureReason(absl::string_view failure_reason) PURE;

  /**
   * @return const std::string& the upstream transport failure reason, e.g. certificate validation
   *         failed.
   */
  virtual const std::string& upstreamTransportFailureReason() const PURE;

  /**
   * @param close_type the upstream detected close type.
   */
  virtual void setUpstreamDetectedCloseType(DetectedCloseType close_type) PURE;

  /**
   * @return StreamInfo::DetectedCloseType the upstream detected close type.
   */
  virtual DetectedCloseType upstreamDetectedCloseType() const PURE;

  /**
   * @param reason the upstream local close reason.
   */
  virtual void setUpstreamLocalCloseReason(absl::string_view reason) PURE;

  /**
   * @return absl::string_view the upstream local close reason, if local close did not occur an
   * empty string view is returned.
   */
  virtual absl::string_view upstreamLocalCloseReason() const PURE;

  /**
   * @param host the selected upstream host for the request.
   */
  virtual void setUpstreamHost(Upstream::HostDescriptionConstSharedPtr host) PURE;

  /**
   * @return upstream host description.
   */
  virtual Upstream::HostDescriptionConstSharedPtr upstreamHost() const PURE;

  /**
   * Filter State object to be shared between upstream and downstream filters.
   * @param pointer to upstream connections filter state.
   * @return pointer to filter state to be used by upstream connections.
   */
  virtual const FilterStateSharedPtr& upstreamFilterState() const PURE;
  virtual void setUpstreamFilterState(const FilterStateSharedPtr& filter_state) PURE;