Malloy
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
malloy::http::filters::basic_file< isRequest > Struct Template Reference

Writes the contents of a message to disk. More...

#include <file.hpp>

Public Types

using response_type = malloy::http::response< boost::beast::http::file_body >
 
using request_type = malloy::http::request< boost::beast::http::file_body >
 
using value_type = boost::beast::http::file_body::value_type
 
using header_type = boost::beast::http::header< isRequest >
 
using setup_handler_t = std::function< void(const header_type &, value_type &)>
 

Public Member Functions

 basic_file ()=default
 Default ctor.
 
 basic_file (setup_handler_t setup_)
 Construct with a setup handler.
 
 basic_file (basic_file &&) noexcept=default
 
basic_fileoperator= (basic_file &&) noexcept=default
 
std::variant< boost::beast::http::file_body > body_for (const header_type &) const
 
void setup_body (const header_type &h, value_type &body) const
 

Static Public Member Functions

static basic_file open (const std::filesystem::path &location, std::function< void(malloy::error_code)> on_error, boost::beast::file_mode mode)
 Create a version of the filter that writes/reads the specified file.
 

Public Attributes

setup_handler_t setup
 

Detailed Description

template<bool isRequest>
struct malloy::http::filters::basic_file< isRequest >

Writes the contents of a message to disk.

This filter is used to write a request/response directly to disk rather than storing it in-memory.

Constructor & Destructor Documentation

◆ basic_file() [1/2]

template<bool isRequest>
malloy::http::filters::basic_file< isRequest >::basic_file ( )
default

Default ctor.

Calls to setup_body will do nothing until setup is set to a valid function

◆ basic_file() [2/2]

template<bool isRequest>
malloy::http::filters::basic_file< isRequest >::basic_file ( basic_file< isRequest > &&  )
defaultnoexcept

Move constructor.

Member Function Documentation

◆ open()

template<bool isRequest>
static basic_file malloy::http::filters::basic_file< isRequest >::open ( const std::filesystem::path &  location,
std::function< void(malloy::error_code)>  on_error,
boost::beast::file_mode  mode 
)
inlinestatic

Create a version of the filter that writes/reads the specified file.

Parameters
locationPath to the file on the local filesystem
on_errorCallback invoked on an error during handling of the request
modeMode to use when opening the file. Should not be a readonly mode (e.g. NOT boost::beast::file_mode::scan)
Here is the call graph for this function:

◆ operator=()

template<bool isRequest>
basic_file & malloy::http::filters::basic_file< isRequest >::operator= ( basic_file< isRequest > &&  )
defaultnoexcept

Move-assignment operator.

Returns
Reference to this object (left hand side)

Member Data Documentation

◆ setup

template<bool isRequest>
setup_handler_t malloy::http::filters::basic_file< isRequest >::setup

The setup handler.


The documentation for this struct was generated from the following file: