summaryrefslogtreecommitdiffstats
path: root/src/tools/immutable_object_cache/CacheServer.h
blob: 31d8599340d588d5750f5f4a15f1dd18a860112e (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
34
35
36
37
38
39
40
41
42
43
44
45
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#ifndef CEPH_CACHE_CACHE_SERVER_H
#define CEPH_CACHE_CACHE_SERVER_H

#include <boost/asio.hpp>
#include <boost/asio/error.hpp>

#include "Types.h"
#include "SocketCommon.h"
#include "CacheSession.h"


using boost::asio::local::stream_protocol;

namespace ceph {
namespace immutable_obj_cache {

class CacheServer {
 public:
  CacheServer(CephContext* cct, const std::string& file, ProcessMsg processmsg);
  ~CacheServer();

  int run();
  int start_accept();
  int stop();

 private:
  void accept();
  void handle_accept(CacheSessionPtr new_session,
                     const boost::system::error_code& error);

 private:
  CephContext* cct;
  boost::asio::io_service m_io_service;
  ProcessMsg m_server_process_msg;
  stream_protocol::endpoint m_local_path;
  stream_protocol::acceptor m_acceptor;
};

}  // namespace immutable_obj_cache
}  // namespace ceph

#endif