forked from ceph/ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrgw_client_io.h
53 lines (37 loc) · 1.22 KB
/
rgw_client_io.h
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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_RGW_CLIENT_IO_H
#define CEPH_RGW_CLIENT_IO_H
#include <stdlib.h>
#include "include/types.h"
#include "rgw_common.h"
class RGWClientIO {
bool account;
size_t bytes_sent;
size_t bytes_received;
protected:
RGWEnv env;
virtual void init_env(CephContext *cct) = 0;
virtual int write_data(const char *buf, int len) = 0;
virtual int read_data(char *buf, int max) = 0;
public:
virtual ~RGWClientIO() {}
RGWClientIO() : account(false), bytes_sent(0), bytes_received(0) {}
void init(CephContext *cct);
int print(const char *format, ...);
int write(const char *buf, int len);
virtual void flush() = 0;
int read(char *buf, int max, int *actual);
virtual int send_status(const char *status, const char *status_name) = 0;
virtual int send_100_continue() = 0;
virtual int complete_header() = 0;
virtual int complete_request() = 0;
virtual int send_content_length(uint64_t len) = 0;
RGWEnv& get_env() { return env; }
void set_account(bool _account) {
account = _account;
}
uint64_t get_bytes_sent() { return bytes_sent; }
uint64_t get_bytes_received() { return bytes_received; }
};
#endif