]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/objectstore/DeterministicOpSequence.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2012 New Dream Network
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
13 #ifndef FILESTORE_DTRMNSTC_SEQ_OPS_H_
14 #define FILESTORE_DTRMNSTC_SEQ_OPS_H_
19 #include "os/ObjectStore.h"
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/random/mersenne_twister.hpp>
22 #include <boost/random/uniform_int.hpp>
24 #include "TestObjectStoreState.h"
26 typedef boost::mt11213b rngen_t
;
28 class DeterministicOpSequence
: public TestObjectStoreState
{
30 DeterministicOpSequence(ObjectStore
*store
, std::string status
= std::string());
31 virtual ~DeterministicOpSequence();
33 virtual void generate(int seed
, int num_txs
);
46 DSOP_FIRST
= DSOP_TOUCH
,
47 DSOP_LAST
= DSOP_COLL_CREATE
,
55 ObjectStore::Sequencer m_osr
;
56 std::ofstream m_status
;
58 bool run_one_op(int op
, rngen_t
& gen
);
60 void note_txn(ObjectStore::Transaction
*t
);
61 bool do_touch(rngen_t
& gen
);
62 bool do_remove(rngen_t
& gen
);
63 bool do_write(rngen_t
& gen
);
64 bool do_clone(rngen_t
& gen
);
65 bool do_clone_range(rngen_t
& gen
);
66 bool do_coll_move(rngen_t
& gen
);
67 bool do_set_attrs(rngen_t
& gen
);
68 bool do_coll_create(rngen_t
& gen
);
70 virtual void _do_touch(coll_t coll
, hobject_t
& obj
);
71 virtual void _do_remove(coll_t coll
, hobject_t
& obj
);
72 virtual void _do_write(coll_t coll
, hobject_t
& obj
, uint64_t off
,
73 uint64_t len
, const bufferlist
& data
);
74 virtual void _do_set_attrs(coll_t coll
,
76 const map
<string
, bufferlist
> &attrs
);
77 virtual void _do_clone(coll_t coll
, hobject_t
& orig_obj
, hobject_t
& new_obj
);
78 virtual void _do_clone_range(coll_t coll
, hobject_t
& orig_obj
,
79 hobject_t
& new_obj
, uint64_t srcoff
, uint64_t srclen
, uint64_t dstoff
);
80 virtual void _do_write_and_clone_range(coll_t coll
, hobject_t
& orig_obj
,
81 hobject_t
& new_obj
, uint64_t srcoff
, uint64_t srclen
,
82 uint64_t dstoff
, bufferlist
& bl
);
83 virtual void _do_coll_move(coll_t orig_coll
, coll_t new_coll
, hobject_t
& obj
);
84 virtual void _do_coll_create(coll_t cid
, uint32_t pg_num
, uint64_t num_objs
);
86 int _gen_coll_id(rngen_t
& gen
);
87 int _gen_obj_id(rngen_t
& gen
);
88 void _print_status(int seq
, int op
);
91 bool _prepare_clone(rngen_t
& gen
, coll_t
& coll_ret
,
92 hobject_t
& orig_obj_ret
, hobject_t
& new_obj_ret
);
93 bool _prepare_colls(rngen_t
& gen
,
94 coll_entry_t
* &orig_coll
, coll_entry_t
* &new_coll
);
98 #endif /* FILESTORE_DTRMNSTC_SEQ_OPS_H_ */