blob: 0b2f6e779c5e2818c2d2e0634eecc89ddea8814a (
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
32
33
34
35
36
37
38
39
40
|
#ifndef GITFS_BLOB_H
#define GITFS_BLOB_H
#include "git.h"
#include <file.h>
#include <git2.h>
#include <string>
#include <types.h>
namespace Ice {
struct Current;
}
namespace GitFS {
using namespace NetFS;
class Repo;
class Blob : public File {
public:
Blob(const Repo * const r, std::string &&);
void close(const ::Ice::Current & current) override;
Attr fgetattr(const ::Ice::Current & current) override;
Buffer read(long long int offset, long long int size, const ::Ice::Current & current) override;
void ftruncate(long long int size, const ::Ice::Current & current) override;
void write(long long int offset, long long int size, std::pair<const Ice::Byte *, const Ice::Byte *> data,
const ::Ice::Current & current) override;
long long int copyrange(
FilePrxPtr, long long int, long long int, long long int, int, const Ice::Current &) override;
private:
Git::BlobPtr getBlob() const;
const Repo * const repo;
Git::TreeEntryPtr entry;
Git::BlobPtr blob;
using BlobSize = decltype(git_blob_rawsize({}));
const BlobSize blobSize;
const char * const blobContent;
};
}
#endif
|