2014-12-11 01:31:21 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef BLOCKSTORE_IMPLEMENTATIONS_INMEMORY_INMEMORYBLOCK_H_
|
|
|
|
#define BLOCKSTORE_IMPLEMENTATIONS_INMEMORY_INMEMORYBLOCK_H_
|
|
|
|
|
2015-03-12 14:27:51 +01:00
|
|
|
#include "../../interface/Block.h"
|
2015-02-17 00:23:33 +01:00
|
|
|
#include "../../utils/Data.h"
|
2014-12-11 01:31:21 +01:00
|
|
|
|
2015-02-17 00:23:33 +01:00
|
|
|
#include "messmer/cpp-utils/macros.h"
|
2014-12-11 01:31:21 +01:00
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
namespace testfake {
|
|
|
|
class FakeBlockStore;
|
|
|
|
|
|
|
|
class FakeBlock: public Block {
|
|
|
|
public:
|
2015-01-24 22:08:41 +01:00
|
|
|
FakeBlock(FakeBlockStore *store, const Key &key, std::shared_ptr<Data> data);
|
2014-12-11 01:31:21 +01:00
|
|
|
virtual ~FakeBlock();
|
|
|
|
|
|
|
|
const void *data() const override;
|
2015-03-04 20:47:02 +01:00
|
|
|
void write(const void *source, uint64_t offset, uint64_t size) override;
|
2014-12-11 01:31:21 +01:00
|
|
|
|
|
|
|
void flush() override;
|
|
|
|
|
|
|
|
size_t size() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
FakeBlockStore *_store;
|
|
|
|
std::shared_ptr<Data> _data;
|
2015-03-05 22:16:57 +01:00
|
|
|
bool _dataChanged;
|
2014-12-11 01:31:21 +01:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(FakeBlock);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|