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
|
|
|
|
2015-01-22 23:37:03 +01:00
|
|
|
#include "DataNode.h"
|
2014-12-09 18:53:11 +01:00
|
|
|
|
|
|
|
namespace blobstore {
|
|
|
|
namespace onblocks {
|
2014-12-13 19:17:08 +01:00
|
|
|
namespace datanodestore {
|
2015-01-24 00:54:27 +01:00
|
|
|
class DataInnerNode;
|
2014-12-09 18:53:11 +01:00
|
|
|
|
|
|
|
class DataLeafNode: public DataNode {
|
|
|
|
public:
|
2015-02-20 19:46:52 +01:00
|
|
|
static std::unique_ptr<DataLeafNode> InitializeNewNode(std::unique_ptr<blockstore::Block> block);
|
|
|
|
|
2015-01-24 22:27:14 +01:00
|
|
|
DataLeafNode(DataNodeView block);
|
2014-12-09 18:53:11 +01:00
|
|
|
virtual ~DataLeafNode();
|
|
|
|
|
2015-02-25 22:30:48 +01:00
|
|
|
uint32_t maxStoreableBytes() const;
|
2014-12-10 23:34:36 +01:00
|
|
|
|
2015-03-04 20:58:39 +01:00
|
|
|
void read(void *target, uint64_t offset, uint64_t size) const;
|
|
|
|
void write(const void *source, uint64_t offset, uint64_t size);
|
2014-12-10 16:48:00 +01:00
|
|
|
|
2015-01-22 23:37:03 +01:00
|
|
|
uint32_t numBytes() const;
|
|
|
|
|
|
|
|
void resize(uint32_t size);
|
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
|
|
|
};
|
|
|
|
|
2014-12-13 19:17:08 +01:00
|
|
|
}
|
2014-12-09 18:53:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|