summaryrefslogtreecommitdiffstats
path: root/src/common/io_exerciser/Model.h
blob: 9e421e79a78dee0c9d756330330469c6f5c610f6 (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
#pragma once

#include <boost/asio/io_context.hpp>

#include "IoOp.h"
#include "common/Thread.h"
#include "global/global_context.h"
#include "global/global_init.h"
#include "include/interval_set.h"
#include "librados/librados_asio.h"

/* Overview
 *
 * class Model
 *   Virtual class. Models apply IoOps generated by an
 *   IoSequence, they can choose how many I/Os to execute in
 *   parallel and scale up the size of I/Os by the blocksize
 *
 */

namespace ceph {
namespace io_exerciser {

class Model {
 protected:
  int num_io{0};
  std::string oid;
  uint64_t block_size;

 public:
  Model(const std::string& oid, uint64_t block_size);
  virtual ~Model() = default;

  virtual bool readyForIoOp(IoOp& op) = 0;
  virtual void applyIoOp(IoOp& op) = 0;

  const std::string get_oid() const;
  const uint64_t get_block_size() const;
  int get_num_io() const;
};

/* Simple RADOS I/O generator */

}  // namespace io_exerciser
}  // namespace ceph