2014-12-09 17:19:59 +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"
|
|
|
|
#include "../../utils/Data.h"
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
namespace inmemory {
|
|
|
|
class InMemoryBlockStore;
|
|
|
|
|
|
|
|
class InMemoryBlock: public Block {
|
|
|
|
public:
|
2015-04-18 14:47:12 +02:00
|
|
|
InMemoryBlock(const Key &key, Data size);
|
2014-12-09 17:19:59 +01:00
|
|
|
InMemoryBlock(const InMemoryBlock &rhs);
|
|
|
|
virtual ~InMemoryBlock();
|
|
|
|
|
|
|
|
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:
|
|
|
|
std::shared_ptr<Data> _data;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|