summaryrefslogtreecommitdiff
path: root/src/blob.h
blob: e1dd86f5b1058b8cfe89dc4c736523388f19167b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef GITFS_BLOB_H
#define GITFS_BLOB_H

#include <file.h>
#include "git.h"

namespace GitFS {
	using namespace NetFS;
	class Repo;
	class Blob : public File {
		public:
			Blob(const Repo * r, const std::string &);

			void close(const ::Ice::Current& current) override;
			Attr fgetattr(ReqEnv env, const ::Ice::Current& current) override;
			Buffer read(long long int offset, long long int size, const ::Ice::Current& current) override;
			void ftruncate(ReqEnv env, long long int size, const ::Ice::Current& current) override;
			void write(long long int offset, long long int size, Buffer data, const ::Ice::Current& current) override;

		private:
			Git::BlobPtr getBlob() const;
			const Repo * repo;
			Git::TreeEntryPtr entry;
			Git::BlobPtr blob;
			const decltype(git_blob_rawsize({})) blobSize;
			const char * const blobContent;
	};
}

#endif