1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 #ifndef SEAFILE_SESSION_H
4 #define SEAFILE_SESSION_H
5 
6 #include <job-mgr.h>
7 
8 #include "block-mgr.h"
9 #include "fs-mgr.h"
10 #include "commit-mgr.h"
11 #include "branch-mgr.h"
12 #include "repo-mgr.h"
13 #include "db.h"
14 #include "seaf-db.h"
15 #include "mq-mgr.h"
16 #include "user-mgr.h"
17 #include "group-mgr.h"
18 #include "org-mgr.h"
19 
20 #include "share-mgr.h"
21 #include "web-accesstoken-mgr.h"
22 #include "passwd-mgr.h"
23 #include "quota-mgr.h"
24 #include "size-sched.h"
25 #include "copy-mgr.h"
26 #include "config-mgr.h"
27 
28 #include "http-server.h"
29 #include "zip-download-mgr.h"
30 #include "index-blocks-mgr.h"
31 
32 #include <searpc-client.h>
33 
34 struct _CcnetClient;
35 
36 typedef struct _SeafileSession SeafileSession;
37 
38 
39 struct _SeafileSession {
40     char                *central_config_dir;
41     char                *seaf_dir;
42     char                *ccnet_dir;
43     char                *tmp_file_dir;
44     /* Config that's only loaded on start */
45     GKeyFile            *config;
46     GKeyFile            *ccnet_config;
47     SeafDB              *db;
48     CcnetDB             *ccnet_db;
49 
50     SeafBlockManager    *block_mgr;
51     SeafFSManager       *fs_mgr;
52     SeafCommitManager   *commit_mgr;
53     SeafBranchManager   *branch_mgr;
54     SeafRepoManager     *repo_mgr;
55     SeafShareManager	*share_mgr;
56     SeafPasswdManager   *passwd_mgr;
57     SeafQuotaManager    *quota_mgr;
58     SeafCopyManager     *copy_mgr;
59     SeafCfgManager      *cfg_mgr;
60     CcnetUserManager    *user_mgr;
61     CcnetGroupManager   *group_mgr;
62     CcnetOrgManager     *org_mgr;
63 
64     SeafWebAccessTokenManager	*web_at_mgr;
65 
66     SeafMqManager       *mq_mgr;
67     CcnetJobManager     *job_mgr;
68 
69     SizeScheduler       *size_sched;
70 
71     int                  cloud_mode;
72 
73     HttpServerStruct    *http_server;
74     ZipDownloadMgr      *zip_download_mgr;
75     IndexBlksMgr        *index_blocks_mgr;
76 
77     gboolean create_tables;
78     gboolean ccnet_create_tables;
79 };
80 
81 extern SeafileSession *seaf;
82 
83 SeafileSession *
84 seafile_session_new(const char *central_config_dir,
85                     const char *seafile_dir,
86                     const char *ccnet_dir);
87 int
88 seafile_session_init (SeafileSession *session);
89 
90 int
91 seafile_session_start (SeafileSession *session);
92 
93 char *
94 seafile_session_get_tmp_file_path (SeafileSession *session,
95                                    const char *basename,
96                                    char path[]);
97 
98 void
99 schedule_create_system_default_repo (SeafileSession *session);
100 
101 char *
102 get_system_default_repo_id (SeafileSession *session);
103 
104 int
105 set_system_default_repo_id (SeafileSession *session, const char *repo_id);
106 
107 #endif /* SEAFILE_H */
108