libcryfs/implementations/onblocks/BlobOnBlocks.h

42 lines
1.0 KiB
C
Raw Normal View History

#pragma once
#ifndef BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_BLOBONBLOCKS_H_
#define BLOBSTORE_IMPLEMENTATIONS_ONBLOCKS_BLOBONBLOCKS_H_
2015-02-17 00:40:34 +01:00
#include "../../interface/Blob.h"
2014-12-09 17:56:48 +01:00
#include <memory>
namespace blobstore {
namespace onblocks {
namespace datanodestore {
class DataLeafNode;
}
namespace datatreestore {
class DataTree;
}
2014-12-09 17:56:48 +01:00
class BlobOnBlocks: public Blob {
public:
BlobOnBlocks(std::unique_ptr<datatreestore::DataTree> datatree);
virtual ~BlobOnBlocks();
2014-12-09 17:56:48 +01:00
uint64_t size() const override;
void resize(uint64_t numBytes) override;
2014-12-09 17:56:48 +01:00
void read(void *target, uint64_t offset, uint64_t size) const;
void write(const void *source, uint64_t offset, uint64_t size);
void flush() const override;
2014-12-09 17:56:48 +01:00
private:
//TODO Don't pass DataLeafNode, but pointer to its data region? Does this work with both read/write (const/nonconst)?
void traverseLeaves(uint64_t offsetBytes, uint64_t sizeBytes, std::function<void (datanodestore::DataLeafNode*, uint64_t, uint32_t, uint32_t)>) const;
std::unique_ptr<datatreestore::DataTree> _datatree;
};
}
}
#endif