aboutsummaryrefslogtreecommitdiff
path: root/src/toast.h
blob: 5a99fbbb34397e201641a46f1ba66d0f87cc23c8 (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
41
42
43
44
45
46
47
48
49
50
51
#ifndef TOAST_H
#define TOAST_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>

enum TYPE_ENUM {
    TYPE_WRITE = 0,
    TYPE_MKDIR = 1,
    TYPE_DELETE = 2,
};

extern const char* TYPE_STRINGS[];

struct file_info {
    enum TYPE_ENUM type;
    char* path;
    char* hash;
    char* object;
};

struct revision_t {
    struct file_info* files;
    size_t file_count;
};

char* getToastDir(char* dir);
int getLatestRemoteRevision(char*);
int getLocalRevision(char*);
void setLocalRevision(char*, int);
char* getLocalRemote(char*);
void setLocalRemote(char*, char*);

struct revision_t* getRevisionData(char*, int);
struct revision_t* fastFowardRevisions(char* url, int from, int to);
void freeRevision(struct revision_t* rev);

size_t downloadObject(char*, char*, struct file_info*);
int applyObject(char*, struct file_info*);
void removeObjects(char*);

int verifyFileHash(char*, struct file_info*);

#ifdef __cplusplus
}
#endif

#endif