summaryrefslogtreecommitdiff
path: root/src/static_files.hh
blob: ecff9870281a55fc618971b38fbbc6896663d4d7 (plain)
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
#ifndef STATIC_FILES_HH
#define STATIC_FILES_HH

#include "transport.hh"

#include <filesystem>
#include <memory>

class Logger;
class SendFile;
class TaskRunner;

class StaticFiles {
public:
  virtual ~StaticFiles() = default;

  static std::unique_ptr<StaticFiles> create(
      std::shared_ptr<Logger> logger,
      std::shared_ptr<TaskRunner> runner,
      std::shared_ptr<SendFile> send_file,
      std::filesystem::path path,
      size_t threads = 1);

  virtual std::unique_ptr<Transport::Response> request(
      Transport* transport, std::string_view path) = 0;

protected:
  StaticFiles() = default;
  StaticFiles(StaticFiles const&) = delete;
  StaticFiles& operator=(StaticFiles const&) = delete;
};

#endif  // STATIC_FILES_HH