Allow Blob::flush

This commit is contained in:
Sebastian Messmer 2015-04-09 23:41:51 +02:00
parent 628f4edec0
commit e3f7b47440
4 changed files with 12 additions and 0 deletions

View File

@ -68,6 +68,10 @@ void BlobOnBlocks::write(const void *source, uint64_t offset, uint64_t size) {
}); });
} }
void BlobOnBlocks::flush() {
_datatree->flush();
}
void BlobOnBlocks::resizeIfSmallerThan(uint64_t neededSize) { void BlobOnBlocks::resizeIfSmallerThan(uint64_t neededSize) {
//TODO This is inefficient, because size() and resizeNumBytes() both traverse the tree. Better: _datatree->ensureMinSize(x) //TODO This is inefficient, because size() and resizeNumBytes() both traverse the tree. Better: _datatree->ensureMinSize(x)
if (neededSize > size()) { if (neededSize > size()) {

View File

@ -29,6 +29,8 @@ public:
uint64_t tryRead(void *target, uint64_t offset, uint64_t size) const override; uint64_t tryRead(void *target, uint64_t offset, uint64_t size) const override;
void write(const void *source, uint64_t offset, uint64_t size) override; void write(const void *source, uint64_t offset, uint64_t size) override;
void flush() override;
std::unique_ptr<cachingdatatreestore::CachedDataTreeRef> releaseTree(); std::unique_ptr<cachingdatatreestore::CachedDataTreeRef> releaseTree();
private: private:

View File

@ -36,6 +36,10 @@ public:
uint64_t numStoredBytes() const { uint64_t numStoredBytes() const {
return _baseTree->numStoredBytes(); return _baseTree->numStoredBytes();
} }
void flush() {
return _baseTree->flush();
}
private: private:
datatreestore::DataTree *_baseTree; datatreestore::DataTree *_baseTree;
}; };

View File

@ -22,6 +22,8 @@ public:
virtual uint64_t tryRead(void *target, uint64_t offset, uint64_t size) const = 0; virtual uint64_t tryRead(void *target, uint64_t offset, uint64_t size) const = 0;
virtual void write(const void *source, uint64_t offset, uint64_t size) = 0; virtual void write(const void *source, uint64_t offset, uint64_t size) = 0;
virtual void flush() = 0;
//TODO Test tryRead //TODO Test tryRead
}; };