Adapt to new blockstore

This commit is contained in:
Sebastian Meßmer 2015-04-18 14:52:38 +02:00
parent 9eec7a8c74
commit f2adbf01df

View File

@ -9,6 +9,7 @@
using blockstore::BlockStore;
using blockstore::Block;
using blockstore::Key;
using blockstore::Data;
using std::unique_ptr;
using std::make_unique;
using std::runtime_error;
@ -39,12 +40,14 @@ unique_ptr<DataNode> DataNodeStore::load(unique_ptr<Block> block) {
unique_ptr<DataInnerNode> DataNodeStore::createNewInnerNode(const DataNode &first_child) {
assert(first_child.node().layout().blocksizeBytes() == _layout.blocksizeBytes()); // This might be violated if source is from a different DataNodeStore
auto block = _blockstore->create(_layout.blocksizeBytes());
//TODO Initialize block and then create it in the blockstore - this is more efficient than creating it and then writing to it
auto block = _blockstore->create(Data(_layout.blocksizeBytes()));
return DataInnerNode::InitializeNewNode(std::move(block), first_child);
}
unique_ptr<DataLeafNode> DataNodeStore::createNewLeafNode() {
auto block = _blockstore->create(_layout.blocksizeBytes());
//TODO Initialize block and then create it in the blockstore - this is more efficient than creating it and then writing to it
auto block = _blockstore->create(Data(_layout.blocksizeBytes()));
return DataLeafNode::InitializeNewNode(std::move(block));
}