2014-12-09 17:19:59 +01:00
|
|
|
#pragma once
|
2015-10-15 13:09:21 +02:00
|
|
|
#ifndef MESSMER_BLOCKSTORE_IMPLEMENTATIONS_INMEMORY_INMEMORYBLOCK_H_
|
|
|
|
#define MESSMER_BLOCKSTORE_IMPLEMENTATIONS_INMEMORY_INMEMORYBLOCK_H_
|
2014-12-09 17:19:59 +01:00
|
|
|
|
2015-03-12 14:27:51 +01:00
|
|
|
#include "../../interface/Block.h"
|
2015-04-25 02:48:41 +02:00
|
|
|
#include <messmer/cpp-utils/data/Data.h>
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
namespace inmemory {
|
|
|
|
class InMemoryBlockStore;
|
|
|
|
|
2015-11-27 14:06:40 +01:00
|
|
|
class InMemoryBlock final: public Block {
|
2014-12-09 17:19:59 +01:00
|
|
|
public:
|
2015-04-25 02:48:41 +02:00
|
|
|
InMemoryBlock(const Key &key, cpputils::Data size);
|
2014-12-09 17:19:59 +01:00
|
|
|
InMemoryBlock(const InMemoryBlock &rhs);
|
2015-11-27 14:06:40 +01:00
|
|
|
~InMemoryBlock();
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
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-09 17:19:59 +01:00
|
|
|
|
|
|
|
void flush() override;
|
|
|
|
|
|
|
|
size_t size() const override;
|
|
|
|
|
|
|
|
private:
|
2015-04-25 02:48:41 +02:00
|
|
|
std::shared_ptr<cpputils::Data> _data;
|
2014-12-09 17:19:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|