X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Ftest%2Fobjectstore%2FFileStoreTracker.h;fp=src%2Fceph%2Fsrc%2Ftest%2Fobjectstore%2FFileStoreTracker.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=d422d1cf1444c410ccbb54ffebae95311cbf178f;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/test/objectstore/FileStoreTracker.h b/src/ceph/src/test/objectstore/FileStoreTracker.h deleted file mode 100644 index d422d1c..0000000 --- a/src/ceph/src/test/objectstore/FileStoreTracker.h +++ /dev/null @@ -1,138 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- - -#ifndef FILESTORE_TRACKER_H -#define FILESTORE_TRACKER_H -#include "test/common/ObjectContents.h" -#include "os/filestore/FileStore.h" -#include "kv/KeyValueDB.h" -#include -#include -#include -#include "common/Mutex.h" - -class FileStoreTracker { - const static uint64_t SIZE = 4 * 1024; - ObjectStore *store; - KeyValueDB *db; - Mutex lock; - uint64_t restart_seq; - - struct OutTransaction { - list, uint64_t> > *in_flight; - ObjectStore::Transaction *t; - }; -public: - FileStoreTracker(ObjectStore *store, KeyValueDB *db) - : store(store), db(db), - lock("Tracker Lock"), restart_seq(0) {} - - class Transaction { - class Op { - public: - virtual void operator()(FileStoreTracker *harness, - OutTransaction *out) = 0; - virtual ~Op() {}; - }; - list ops; - class Write : public Op { - public: - coll_t coll; - string oid; - Write(const coll_t &coll, - const string &oid) - : coll(coll), oid(oid) {} - void operator()(FileStoreTracker *harness, - OutTransaction *out) override { - harness->write(make_pair(coll, oid), out); - } - }; - class CloneRange : public Op { - public: - coll_t coll; - string from; - string to; - CloneRange(const coll_t &coll, - const string &from, - const string &to) - : coll(coll), from(from), to(to) {} - void operator()(FileStoreTracker *harness, - OutTransaction *out) override { - harness->clone_range(make_pair(coll, from), make_pair(coll, to), - out); - } - }; - class Clone : public Op { - public: - coll_t coll; - string from; - string to; - Clone(const coll_t &coll, - const string &from, - const string &to) - : coll(coll), from(from), to(to) {} - void operator()(FileStoreTracker *harness, - OutTransaction *out) override { - harness->clone(make_pair(coll, from), make_pair(coll, to), - out); - } - }; - class Remove: public Op { - public: - coll_t coll; - string obj; - Remove(const coll_t &coll, - const string &obj) - : coll(coll), obj(obj) {} - void operator()(FileStoreTracker *harness, - OutTransaction *out) override { - harness->remove(make_pair(coll, obj), - out); - } - }; - public: - void write(const coll_t &coll, const string &oid) { - ops.push_back(new Write(coll, oid)); - } - void clone_range(const coll_t &coll, const string &from, - const string &to) { - ops.push_back(new CloneRange(coll, from, to)); - } - void clone(const coll_t &coll, const string &from, - const string &to) { - ops.push_back(new Clone(coll, from, to)); - } - void remove(const coll_t &coll, const string &oid) { - ops.push_back(new Remove(coll, oid)); - } - friend class FileStoreTracker; - }; - - int init(); - void submit_transaction(Transaction &t); - void verify(const coll_t &coll, - const string &from, - bool on_start = false); - -private: - ObjectContents get_current_content(const pair &obj); - pair get_valid_reads(const pair &obj); - ObjectContents get_content(const pair &obj, uint64_t version); - - void committed(const pair &obj, uint64_t seq); - void applied(const pair &obj, uint64_t seq); - uint64_t set_content(const pair &obj, ObjectContents &content); - - // ObjectContents Operations - void write(const pair &obj, OutTransaction *out); - void remove(const pair &obj, OutTransaction *out); - void clone_range(const pair &from, - const pair &to, - OutTransaction *out); - void clone(const pair &from, - const pair &to, - OutTransaction *out); - friend class OnApplied; - friend class OnCommitted; -}; - -#endif