1 #ifndef COPY_MGR_H
2 #define COPY_MGR_H
3 
4 #include <glib.h>
5 
6 #define COPY_ERR_INTERNAL  "Internal error when copy or move"
7 #define COPY_ERR_BAD_ARG  "Invalid arguments"
8 #define COPY_ERR_TOO_MANY_FILES "Too many files"
9 #define COPY_ERR_SIZE_TOO_LARGE "Folder or file size is too large"
10 #define COPY_ERR_QUOTA_IS_FULL  "Quota is full"
11 
12 struct _SeafileSession;
13 struct _SeafCopyManagerPriv;
14 struct _SeafileCopyTask;
15 
16 struct _SeafCopyManager {
17     struct _SeafileSession *session;
18     struct _SeafCopyManagerPriv *priv;
19 
20     gint64 max_files;
21     gint64 max_size;
22 };
23 typedef struct _SeafCopyManager SeafCopyManager;
24 typedef struct _SeafCopyManagerPriv SeafCopyManagerPriv;
25 
26 struct CopyTask {
27     char task_id[37];
28     gint64 done;
29     gint64 total;
30     gint canceled;
31     gboolean failed;
32     char *failed_reason;
33     gboolean successful;
34 };
35 typedef struct CopyTask CopyTask;
36 
37 SeafCopyManager *
38 seaf_copy_manager_new (struct _SeafileSession *session);
39 
40 int
41 seaf_copy_manager_start (SeafCopyManager *mgr);
42 
43 typedef int (*CopyTaskFunc) (const char *, const char *, const char *,
44                              const char *, const char *, const char *,
45                              int, const char *, CopyTask *);
46 
47 char *
48 seaf_copy_manager_add_task (SeafCopyManager *mgr,
49                             const char *src_repo_id,
50                             const char *src_path,
51                             const char *src_filename,
52                             const char *dst_repo_id,
53                             const char *dst_path,
54                             const char *dst_filename,
55                             int replace,
56                             const char *modifier,
57                             CopyTaskFunc function,
58                             gboolean need_progress);
59 
60 struct _SeafileCopyTask *
61 seaf_copy_manager_get_task (SeafCopyManager *mgr,
62                             const char * id);
63 
64 int
65 seaf_copy_manager_cancel_task (SeafCopyManager *mgr, const char *task_id);
66 
67 #endif
68