2014-12-09 18:53:11 +01:00
|
|
|
#pragma once
|
2014-12-13 17:48:02 +01:00
|
|
|
#ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATALEAFNODE_H_
|
|
|
|
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_DATANODESTORE_DATALEAFNODE_H_
|
2014-12-09 18:53:11 +01:00
|
|
|
|
2014-12-13 17:48:02 +01:00
|
|
|
#include <blobstore/implementations/onblocks/datanodestore/DataNode.h>
|
2014-12-09 18:53:11 +01:00
|
|
|
|
|
|
|
namespace blobstore {
|
|
|
|
namespace onblocks {
|
|
|
|
|
|
|
|
class DataLeafNode: public DataNode {
|
|
|
|
public:
|
2014-12-13 17:43:02 +01:00
|
|
|
DataLeafNode(DataNodeView block, const Key &key, DataNodeStore *nodestorage);
|
2014-12-09 18:53:11 +01:00
|
|
|
virtual ~DataLeafNode();
|
|
|
|
|
2014-12-10 23:34:36 +01:00
|
|
|
static constexpr uint32_t MAX_STORED_BYTES = DataNodeView::DATASIZE_BYTES;
|
|
|
|
|
2014-12-10 22:55:02 +01:00
|
|
|
void InitializeNewNode();
|
|
|
|
|
2014-12-11 00:24:50 +01:00
|
|
|
void read(off_t offset, size_t count, blockstore::Data *result) const override;
|
2014-12-10 16:48:00 +01:00
|
|
|
void write(off_t offset, size_t count, const blockstore::Data &data) override;
|
|
|
|
|
2014-12-11 00:24:50 +01:00
|
|
|
uint64_t numBytesInThisNode() const override;
|
2014-12-10 23:34:36 +01:00
|
|
|
void resize(uint64_t newsize_bytes) override;
|
2014-12-09 18:53:11 +01:00
|
|
|
|
2014-12-11 00:20:23 +01:00
|
|
|
private:
|
|
|
|
void fillDataWithZeroesFromTo(off_t begin, off_t end);
|
2014-12-09 18:53:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|