summaryrefslogtreecommitdiffstats
path: root/src/common/io_exerciser/IoOp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/io_exerciser/IoOp.h')
-rw-r--r--src/common/io_exerciser/IoOp.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/common/io_exerciser/IoOp.h b/src/common/io_exerciser/IoOp.h
new file mode 100644
index 00000000000..60c02a93d4e
--- /dev/null
+++ b/src/common/io_exerciser/IoOp.h
@@ -0,0 +1,94 @@
+#pragma once
+
+#include <string>
+#include <memory>
+#include "include/ceph_assert.h"
+
+/* Overview
+ *
+ * enum OpType
+ * Enumeration of different types of I/O operation
+ *
+ * class IoOp
+ * Stores details for an I/O operation. Generated by IoSequences
+ * and applied by IoExerciser's
+ */
+
+namespace ceph {
+ namespace io_exerciser {
+
+ enum class OpType {
+ Done, // End of I/O sequence
+ BARRIER, // Barrier - all prior I/Os must complete
+ CREATE, // Create object and pattern with data
+ REMOVE, // Remove object
+ READ, // Read
+ READ2, // 2 Reads in one op
+ READ3, // 3 Reads in one op
+ WRITE, // Write
+ WRITE2, // 2 Writes in one op
+ WRITE3 // 3 Writes in one op
+ };
+
+ class IoOp {
+ protected:
+ std::string value_to_string(uint64_t v) const;
+
+ public:
+ OpType op;
+ uint64_t offset1;
+ uint64_t length1;
+ uint64_t offset2;
+ uint64_t length2;
+ uint64_t offset3;
+ uint64_t length3;
+
+ IoOp( OpType op,
+ uint64_t offset1 = 0, uint64_t length1 = 0,
+ uint64_t offset2 = 0, uint64_t length2 = 0,
+ uint64_t offset3 = 0, uint64_t length3 = 0 );
+
+ static std::unique_ptr<IoOp> generate_done();
+
+ static std::unique_ptr<IoOp> generate_barrier();
+
+ static std::unique_ptr<IoOp> generate_create(uint64_t size);
+
+ static std::unique_ptr<IoOp> generate_remove();
+
+ static std::unique_ptr<IoOp> generate_read(uint64_t offset,
+ uint64_t length);
+
+ static std::unique_ptr<IoOp> generate_read2(uint64_t offset1,
+ uint64_t length1,
+ uint64_t offset2,
+ uint64_t length2);
+
+ static std::unique_ptr<IoOp> generate_read3(uint64_t offset1,
+ uint64_t length1,
+ uint64_t offset2,
+ uint64_t length2,
+ uint64_t offset3,
+ uint64_t length3);
+
+ static std::unique_ptr<IoOp> generate_write(uint64_t offset,
+ uint64_t length);
+
+ static std::unique_ptr<IoOp> generate_write2(uint64_t offset1,
+ uint64_t length1,
+ uint64_t offset2,
+ uint64_t length2);
+
+ static std::unique_ptr<IoOp> generate_write3(uint64_t offset1,
+ uint64_t length1,
+ uint64_t offset2,
+ uint64_t length2,
+ uint64_t offset3,
+ uint64_t length3);
+
+ bool done();
+
+ std::string to_string(uint64_t block_size) const;
+ };
+ }
+} \ No newline at end of file