forked from ravinet/mahimahi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbacking_store.hh
34 lines (27 loc) · 908 Bytes
/
backing_store.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* -*-mode:c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef BACKING_STORE_HH
#define BACKING_STORE_HH
#include <string>
#include <mutex>
#include "http_request.hh"
#include "http_response.hh"
#include "address.hh"
#include "socket.hh"
/* abstract base class to store an HTTP request/response from a particular server address */
class HTTPBackingStore
{
public:
virtual void save( const HTTPResponse & response, const Address & server_address ) = 0;
virtual void serialize_to_socket( Socket && client ) = 0;
};
class HTTPDiskStore : public HTTPBackingStore
{
private:
std::string record_folder_;
std::mutex mutex_;
public:
HTTPDiskStore( const std::string & record_folder );
void save( const HTTPResponse & response, const Address & server_address ) override;
void serialize_to_socket( Socket && client ) override;
};
#endif /* BACKING_STORE_HH */