blob: 0826e8a2b9a19dfd7095e68b9cc649a64ac254d0 (
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
46
47
48
49
50
51
52
53
54
55
56
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_CACHE_SESSION_H
#define CEPH_CACHE_SESSION_H
#include <boost/asio.hpp>
#include <boost/asio/error.hpp>
#include "Types.h"
#include "SocketCommon.h"
using boost::asio::local::stream_protocol;
using boost::asio::io_service;
namespace ceph {
namespace immutable_obj_cache {
class CacheSession : public std::enable_shared_from_this<CacheSession> {
public:
CacheSession(io_service& io_service, ProcessMsg process_msg,
CephContext* ctx);
~CacheSession();
stream_protocol::socket& socket();
void close();
void start();
void read_request_header();
void handle_request_header(const boost::system::error_code& err,
size_t bytes_transferred);
void read_request_data(uint64_t data_len);
void handle_request_data(bufferptr bp, uint64_t data_len,
const boost::system::error_code& err,
size_t bytes_transferred);
void process(ObjectCacheRequest* req);
void fault(const boost::system::error_code& ec);
void send(ObjectCacheRequest* msg);
void set_client_version(const std::string &version);
const std::string &client_version() const;
private:
stream_protocol::socket m_dm_socket;
ProcessMsg m_server_process_msg;
CephContext* m_cct;
std::string m_client_version;
bufferptr m_bp_header;
};
typedef std::shared_ptr<CacheSession> CacheSessionPtr;
} // namespace immutable_obj_cache
} // namespace ceph
#endif // CEPH_CACHE_SESSION_H
|