2015-02-27 00:51:51 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef CRYFS_LIB_IMPL_FILEBLOB_H_
|
|
|
|
#define CRYFS_LIB_IMPL_FILEBLOB_H_
|
|
|
|
|
|
|
|
#include <messmer/blobstore/interface/Blob.h>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace cryfs {
|
|
|
|
|
|
|
|
class FileBlob {
|
|
|
|
public:
|
2015-03-11 00:23:52 +01:00
|
|
|
static std::unique_ptr<FileBlob> InitializeEmptyFile(std::unique_ptr<blobstore::Blob> blob);
|
|
|
|
|
2015-02-27 00:51:51 +01:00
|
|
|
FileBlob(std::unique_ptr<blobstore::Blob> blob);
|
|
|
|
virtual ~FileBlob();
|
|
|
|
|
2015-03-08 03:51:19 +01:00
|
|
|
void read(void *target, uint64_t offset, uint64_t count) const;
|
|
|
|
void write(const void *source, uint64_t offset, uint64_t count);
|
|
|
|
|
2015-03-11 00:23:52 +01:00
|
|
|
void resize(off_t size);
|
2015-03-11 00:34:25 +01:00
|
|
|
off_t size() const;
|
2015-03-11 00:23:52 +01:00
|
|
|
|
2015-03-08 03:51:19 +01:00
|
|
|
blockstore::Key key() const;
|
|
|
|
|
2015-02-27 00:51:51 +01:00
|
|
|
private:
|
|
|
|
std::unique_ptr<blobstore::Blob> _blob;
|
|
|
|
|
|
|
|
unsigned char magicNumber() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|