#include #include "blob.h" GitFS::Blob::Blob(const GitFS::Git::RepositoryPtr & r, const GitFS::Git::TreeEntryPtr & te) : blob(Git::BlobLookup(r, *git_tree_entry_id(te.get()))), blobSize(git_blob_rawsize(blob.get())), blobContent(static_cast(git_blob_rawcontent(blob.get()))) { } void GitFS::Blob::close(const ::Ice::Current& current) { current.adapter->remove(current.id); } NetFS::Attr GitFS::Blob::fgetattr(ReqEnv, const ::Ice::Current&) { return {}; } NetFS::Buffer GitFS::Blob::read(long long int offset, long long int size, const ::Ice::Current&) { if (offset > blobSize) { return {}; } auto len = std::min(blobSize - offset, size); return NetFS::Buffer(blobContent + offset, blobContent + offset + len); } void GitFS::Blob::ftruncate(ReqEnv, long long int, const ::Ice::Current&) { throw NetFS::SystemError(EROFS); } void GitFS::Blob::write(long long int, long long int, Buffer, const ::Ice::Current&) { throw NetFS::SystemError(EROFS); }