LCOV - code coverage report
Current view: top level - envoy/router - shadow_writer.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 1 1 100.0 %
Date: 2024-01-05 06:35:25 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <chrono>
       4             : #include <memory>
       5             : #include <string>
       6             : 
       7             : #include "envoy/http/async_client.h"
       8             : #include "envoy/http/message.h"
       9             : 
      10             : namespace Envoy {
      11             : namespace Router {
      12             : 
      13             : /**
      14             :  * Interface used to shadow complete requests to an alternate upstream cluster in a "fire and
      15             :  * forget" fashion. Right now this interface takes a fully buffered request and cannot be used for
      16             :  * streaming. This is sufficient for current use cases.
      17             :  */
      18             : class ShadowWriter {
      19             : public:
      20         175 :   virtual ~ShadowWriter() = default;
      21             : 
      22             :   /**
      23             :    * Shadow a request.
      24             :    * @param cluster supplies the cluster name to shadow to.
      25             :    * @param message supplies the complete request to shadow.
      26             :    * @param options supplies the request options for the underlying asynchronous request.
      27             :    */
      28             :   virtual void shadow(const std::string& cluster, Http::RequestMessagePtr&& request,
      29             :                       const Http::AsyncClient::RequestOptions& options) PURE;
      30             : 
      31             :   /**
      32             :    * Initialize shadowing a request. Differs from the above in that additional
      33             :    * data can be passed to the returned handle after the headers have been sent.
      34             :    * @param cluster supplies the cluster name to shadow to.
      35             :    * @param headers supplies the headers for initializing the shadow.
      36             :    * @param options supplies the request options for the underlying asynchronous request.
      37             :    * @return OngoingRequest* pointer owned by the AsyncClient which can have additional data and
      38             :    *                         trailers sent to it. Can be null if the stream is immediately
      39             :    *                         cancelled.
      40             :    */
      41             :   virtual Http::AsyncClient::OngoingRequest*
      42             :   streamingShadow(const std::string& cluster, Http::RequestHeaderMapPtr&& headers,
      43             :                   const Http::AsyncClient::RequestOptions& options) PURE;
      44             : };
      45             : 
      46             : using ShadowWriterPtr = std::unique_ptr<ShadowWriter>;
      47             : 
      48             : } // namespace Router
      49             : } // namespace Envoy

Generated by: LCOV version 1.15