2012-07-27 19:47:42 +08:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
|
|
|
|
#ifndef SEAF_REPO_MGR_H
|
|
|
|
#define SEAF_REPO_MGR_H
|
|
|
|
|
2012-12-19 17:08:25 +08:00
|
|
|
#include "common.h"
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#include "seafile-object.h"
|
|
|
|
#include "commit-mgr.h"
|
|
|
|
#include "branch-mgr.h"
|
|
|
|
|
|
|
|
#define REPO_AUTO_SYNC "auto-sync"
|
|
|
|
#define REPO_AUTO_FETCH "auto-fetch"
|
|
|
|
#define REPO_AUTO_UPLOAD "auto-upload"
|
|
|
|
#define REPO_AUTO_MERGE "auto-merge"
|
|
|
|
#define REPO_AUTO_COMMIT "auto-commit"
|
|
|
|
#define REPO_RELAY_ID "relay-id"
|
|
|
|
#define REPO_NET_BROWSABLE "net-browsable"
|
|
|
|
#define REPO_DOUBLE_SYNC "double-sync"
|
|
|
|
#define REPO_REMOTE_HEAD "remote-head"
|
2013-04-22 14:47:33 +08:00
|
|
|
#define REPO_LOCAL_HEAD "local-head"
|
2012-07-27 19:47:42 +08:00
|
|
|
#define REPO_PROP_EMAIL "email"
|
|
|
|
#define REPO_PROP_TOKEN "token"
|
|
|
|
#define REPO_PROP_RELAY_ADDR "relay-address"
|
|
|
|
#define REPO_PROP_RELAY_PORT "relay-port"
|
|
|
|
#define REPO_ENCRYPTED 0x1
|
2014-07-08 20:22:32 +08:00
|
|
|
#define REPO_PROP_DOWNLOAD_HEAD "download-head"
|
2014-08-22 23:17:43 +08:00
|
|
|
#define REPO_PROP_IS_READONLY "is-readonly"
|
2014-08-29 17:50:40 +08:00
|
|
|
#define REPO_PROP_SERVER_URL "server-url"
|
2012-07-27 19:47:42 +08:00
|
|
|
|
|
|
|
struct _SeafRepoManager;
|
|
|
|
typedef struct _SeafRepo SeafRepo;
|
|
|
|
|
2014-08-22 23:17:43 +08:00
|
|
|
/* The caller can use the properties directly. But the caller should
|
|
|
|
* always write on repos via the API.
|
|
|
|
*/
|
2012-07-27 19:47:42 +08:00
|
|
|
struct _SeafRepo {
|
|
|
|
struct _SeafRepoManager *manager;
|
|
|
|
|
|
|
|
gchar id[37];
|
|
|
|
gchar *name;
|
|
|
|
gchar *desc;
|
|
|
|
gchar *category; /* not used yet */
|
|
|
|
gboolean encrypted;
|
|
|
|
int enc_version;
|
2013-09-04 20:06:18 +08:00
|
|
|
gchar magic[65]; /* hash(repo_id + passwd), key stretched. */
|
|
|
|
gchar random_key[97]; /* key length is 48 after encryption */
|
2012-07-27 19:47:42 +08:00
|
|
|
gboolean no_local_history;
|
|
|
|
|
|
|
|
SeafBranch *head;
|
|
|
|
|
|
|
|
gboolean is_corrupted;
|
|
|
|
gboolean delete_pending;
|
|
|
|
|
|
|
|
gchar *relay_id;
|
|
|
|
gchar *worktree;
|
|
|
|
gboolean wt_changed;
|
|
|
|
int wt_check_time;
|
|
|
|
int last_sync_time;
|
|
|
|
|
2014-12-10 11:59:17 +08:00
|
|
|
/* Last time check locked files. */
|
|
|
|
int last_check_locked_time;
|
|
|
|
gboolean checking_locked_files;
|
|
|
|
|
2013-09-04 20:06:18 +08:00
|
|
|
unsigned char enc_key[32]; /* 256-bit encryption key */
|
2013-09-25 11:58:00 +08:00
|
|
|
unsigned char enc_iv[16];
|
2012-07-27 19:47:42 +08:00
|
|
|
|
|
|
|
gchar *email; /* email of the user on the relay */
|
|
|
|
gchar *token; /* token for access this repo on server */
|
|
|
|
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
|
|
|
|
gboolean worktree_invalid; /* true if worktree moved or deleted */
|
|
|
|
gboolean index_corrupted;
|
2014-08-22 23:17:43 +08:00
|
|
|
gboolean is_readonly;
|
2012-07-27 19:47:42 +08:00
|
|
|
|
|
|
|
unsigned int auto_sync : 1;
|
|
|
|
unsigned int net_browsable : 1;
|
|
|
|
unsigned int quota_full_notified : 1;
|
|
|
|
unsigned int access_denied_notified : 1;
|
2014-03-03 10:09:57 +08:00
|
|
|
|
|
|
|
int version;
|
2014-07-08 10:51:34 +08:00
|
|
|
|
|
|
|
gboolean create_partial_commit;
|
2014-08-29 17:50:40 +08:00
|
|
|
|
|
|
|
/* Used for http sync. */
|
|
|
|
char *server_url;
|
2012-07-27 19:47:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
gboolean is_repo_id_valid (const char *id);
|
|
|
|
|
|
|
|
SeafRepo*
|
|
|
|
seaf_repo_new (const char *id, const char *name, const char *desc);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_free (SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
2013-04-09 13:13:22 +08:00
|
|
|
seaf_repo_set_head (SeafRepo *repo, SeafBranch *branch);
|
2012-07-27 19:47:42 +08:00
|
|
|
|
2014-03-22 12:58:49 +08:00
|
|
|
SeafCommit *
|
|
|
|
seaf_repo_get_head_commit (const char *repo_id);
|
|
|
|
|
2014-08-22 23:17:43 +08:00
|
|
|
void
|
|
|
|
seaf_repo_set_readonly (SeafRepo *repo);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_unset_readonly (SeafRepo *repo);
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
int
|
|
|
|
seaf_repo_checkdir (SeafRepo *repo);
|
|
|
|
|
|
|
|
/* Update repo name, desc, magic etc from commit.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
seaf_repo_from_commit (SeafRepo *repo, SeafCommit *commit);
|
|
|
|
|
|
|
|
/* Update repo-related fields to commit.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
seaf_repo_to_commit (SeafRepo *repo, SeafCommit *commit);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns a list of all commits belongs to the repo.
|
|
|
|
* The commits in the repos are all unique.
|
|
|
|
*/
|
|
|
|
GList *
|
|
|
|
seaf_repo_get_commits (SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_index_add (SeafRepo *repo, const char *path);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_index_worktree_files (const char *repo_id,
|
2014-03-03 10:09:57 +08:00
|
|
|
int version,
|
2014-03-22 12:58:49 +08:00
|
|
|
const char *modifier,
|
2012-07-27 19:47:42 +08:00
|
|
|
const char *worktree,
|
|
|
|
const char *passwd,
|
2013-09-04 20:06:18 +08:00
|
|
|
int enc_version,
|
|
|
|
const char *random_key,
|
2012-07-27 19:47:42 +08:00
|
|
|
char *root_id);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_index_rm (SeafRepo *repo, const char *path);
|
|
|
|
|
|
|
|
char *
|
|
|
|
seaf_repo_status (SeafRepo *repo);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
seaf_repo_is_worktree_changed (SeafRepo *repo);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
seaf_repo_is_index_unmerged (SeafRepo *repo);
|
|
|
|
|
|
|
|
char *
|
2014-06-09 17:17:23 +08:00
|
|
|
seaf_repo_index_commit (SeafRepo *repo, const char *desc, gboolean is_initial_commit,
|
|
|
|
GError **error);
|
2012-07-27 19:47:42 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_checkout (SeafRepo *repo, const char *worktree_parent, char **error);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_reset (SeafRepo *repo, const char *commit_id, char **error);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_revert (SeafRepo *repo, const char *commit_id, char **error);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_checkout_commit (SeafRepo *repo, SeafCommit *commit, gboolean recover_merge,
|
|
|
|
char **error);
|
|
|
|
|
2014-05-12 16:20:09 +08:00
|
|
|
enum {
|
|
|
|
MERGE_STATUS_UNKNOWN = 0,
|
|
|
|
MERGE_STATUS_UPTODATE,
|
|
|
|
MERGE_STATUS_FAST_FORWARD,
|
|
|
|
MERGE_STATUS_REAL_MERGE,
|
|
|
|
};
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
int
|
2012-08-18 13:05:19 +08:00
|
|
|
seaf_repo_merge (SeafRepo *repo, const char *branch, char **error,
|
2014-05-12 16:20:09 +08:00
|
|
|
int *merge_status);
|
2012-07-27 19:47:42 +08:00
|
|
|
|
|
|
|
GList *
|
|
|
|
seaf_repo_diff (SeafRepo *repo, const char *arg1, const char *arg2, char **error);
|
|
|
|
|
|
|
|
typedef struct _SeafRepoManager SeafRepoManager;
|
|
|
|
typedef struct _SeafRepoManagerPriv SeafRepoManagerPriv;
|
|
|
|
|
|
|
|
struct _SeafRepoManager {
|
|
|
|
struct _SeafileSession *seaf;
|
|
|
|
|
|
|
|
char *index_dir;
|
|
|
|
|
|
|
|
SeafRepoManagerPriv *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
SeafRepoManager*
|
|
|
|
seaf_repo_manager_new (struct _SeafileSession *seaf);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_init (SeafRepoManager *mgr);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_start (SeafRepoManager *mgr);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_add_repo (SeafRepoManager *mgr, SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_mark_repo_deleted (SeafRepoManager *mgr, SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_del_repo (SeafRepoManager *mgr, SeafRepo *repo);
|
|
|
|
|
2013-10-22 15:42:02 +08:00
|
|
|
void
|
2014-03-03 10:09:57 +08:00
|
|
|
seaf_repo_manager_remove_repo_ondisk (SeafRepoManager *mgr, const char *repo_id,
|
|
|
|
gboolean add_deleted_record);
|
2013-10-22 15:42:02 +08:00
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
SeafRepo*
|
|
|
|
seaf_repo_manager_create_new_repo (SeafRepoManager *mgr,
|
|
|
|
const char *name,
|
|
|
|
const char *desc);
|
|
|
|
|
|
|
|
SeafRepo*
|
|
|
|
seaf_repo_manager_get_repo (SeafRepoManager *manager, const gchar *id);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
seaf_repo_manager_repo_exists (SeafRepoManager *manager, const gchar *id);
|
|
|
|
|
|
|
|
GList*
|
|
|
|
seaf_repo_manager_get_repo_list (SeafRepoManager *mgr, int start, int limit);
|
|
|
|
|
2014-03-03 10:09:57 +08:00
|
|
|
GList *
|
|
|
|
seaf_repo_manager_list_garbage_repos (SeafRepoManager *mgr);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_manager_remove_garbage_repo (SeafRepoManager *mgr, const char *repo_id);
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
#define MAX_REPO_TOKEN 64
|
|
|
|
#define DEFAULT_REPO_TOKEN "default"
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_token (SeafRepoManager *manager,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *token);
|
|
|
|
|
2015-03-03 16:56:49 +08:00
|
|
|
int
|
|
|
|
seaf_repo_manager_remove_repo_token (SeafRepoManager *manager,
|
|
|
|
SeafRepo *repo);
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_email (SeafRepoManager *manager,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *email);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_relay_info (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *relay_addr,
|
|
|
|
const char *relay_port);
|
|
|
|
void
|
|
|
|
seaf_repo_manager_get_repo_relay_info (SeafRepoManager *mgr,
|
|
|
|
const char *repo_id,
|
|
|
|
char **relay_addr,
|
|
|
|
char **relay_port);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_branch_repo_unmap (SeafRepoManager *manager, SeafBranch *branch);
|
|
|
|
|
|
|
|
char *
|
|
|
|
seaf_repo_manager_get_repo_lantoken (SeafRepoManager *manager,
|
|
|
|
const char *repo_id);
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_lantoken (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *token);
|
|
|
|
int
|
|
|
|
seaf_repo_manager_verify_repo_lantoken (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *token);
|
|
|
|
|
|
|
|
char *
|
|
|
|
seaf_repo_manager_generate_tmp_token (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *peer_id);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_verify_tmp_token (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *peer_id,
|
|
|
|
const char *token);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_property (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *key,
|
|
|
|
const char *value);
|
|
|
|
|
|
|
|
char *
|
|
|
|
seaf_repo_manager_get_repo_property (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *key);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_mamager_del_repo_property (SeafRepoManager *manager, SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_check_worktree (SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_worktree (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *worktree);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_manager_invalidate_repo_worktree (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_manager_validate_repo_worktree (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_passwd (SeafRepoManager *manager,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *passwd);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_repo_relay_id (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *relay_id);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_merge (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
2013-06-06 20:07:19 +08:00
|
|
|
const char *remote_head);
|
2012-07-27 19:47:42 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_clear_merge (SeafRepoManager *manager,
|
|
|
|
const char *repo_id);
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
gboolean in_merge;
|
2013-06-06 20:07:19 +08:00
|
|
|
char remote_head[41];
|
2012-07-27 19:47:42 +08:00
|
|
|
} SeafRepoMergeInfo;
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_get_merge_info (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
SeafRepoMergeInfo *info);
|
2014-01-16 15:07:29 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_get_common_ancestor (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
char *common_ancestor,
|
|
|
|
char *head_id);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_set_common_ancestor (SeafRepoManager *manager,
|
|
|
|
const char *repo_id,
|
|
|
|
const char *common_ancestor,
|
|
|
|
const char *head_id);
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
typedef struct {
|
|
|
|
char repo_id[41];
|
2012-12-19 17:08:25 +08:00
|
|
|
char worktree[SEAF_PATH_MAX];
|
2012-07-27 19:47:42 +08:00
|
|
|
int total_files;
|
|
|
|
int finished_files;
|
|
|
|
gboolean success;
|
|
|
|
} CheckoutTask;
|
|
|
|
|
|
|
|
typedef void (*CheckoutDoneCallback) (CheckoutTask *, SeafRepo *, void *);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_add_checkout_task (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *worktree,
|
|
|
|
CheckoutDoneCallback done_cb,
|
|
|
|
void *cb_data);
|
|
|
|
|
|
|
|
/* Remove all the files in the worktree and then checkout again.
|
|
|
|
* Can be used to re-checkout if wrong password was given.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
seaf_repo_manager_add_recheckout_task (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo,
|
|
|
|
CheckoutDoneCallback done_cb,
|
|
|
|
void *cb_data);
|
|
|
|
|
|
|
|
CheckoutTask *
|
|
|
|
seaf_repo_manager_get_checkout_task (SeafRepoManager *mgr,
|
|
|
|
const char *repo_id);
|
2013-01-28 15:45:52 +08:00
|
|
|
int
|
|
|
|
seaf_repo_manager_update_repo_relay_info (SeafRepoManager *mgr,
|
|
|
|
SeafRepo *repo,
|
|
|
|
const char *new_addr,
|
|
|
|
const char *new_port);
|
2013-05-25 16:54:42 +08:00
|
|
|
|
2014-08-14 23:48:18 +08:00
|
|
|
int
|
|
|
|
seaf_repo_manager_update_repos_server_host (SeafRepoManager *mgr,
|
|
|
|
const char *old_host,
|
2015-02-15 18:05:53 +08:00
|
|
|
const char *new_host,
|
|
|
|
const char *new_server_url);
|
2014-08-14 23:48:18 +08:00
|
|
|
|
2013-06-06 11:50:11 +08:00
|
|
|
GList *
|
|
|
|
seaf_repo_load_ignore_files (const char *worktree);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
seaf_repo_check_ignore_file (GList *ignore_list, const char *fullpath);
|
|
|
|
|
|
|
|
void
|
|
|
|
seaf_repo_free_ignore_files (GList *ignore_list);
|
|
|
|
|
2014-07-08 20:22:32 +08:00
|
|
|
enum {
|
|
|
|
FETCH_CHECKOUT_SUCCESS = 0,
|
|
|
|
FETCH_CHECKOUT_CANCELED,
|
|
|
|
FETCH_CHECKOUT_FAILED,
|
2014-08-12 17:59:13 +08:00
|
|
|
FETCH_CHECKOUT_TRANSFER_ERROR,
|
2014-12-12 20:21:12 +08:00
|
|
|
FETCH_CHECKOUT_LOCKED,
|
2014-07-08 20:22:32 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _TransferTask;
|
2014-08-29 17:50:40 +08:00
|
|
|
struct _HttpTxTask;
|
2014-07-08 20:22:32 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_fetch_and_checkout (struct _TransferTask *task,
|
2014-08-29 17:50:40 +08:00
|
|
|
struct _HttpTxTask *http_task,
|
|
|
|
gboolean is_http,
|
2014-07-08 20:22:32 +08:00
|
|
|
const char *remote_head_id);
|
|
|
|
|
2014-11-13 14:06:37 +08:00
|
|
|
gboolean
|
|
|
|
seaf_repo_manager_is_ignored_hidden_file (const char *filename);
|
|
|
|
|
2014-12-18 18:00:53 +08:00
|
|
|
/* Locked files. */
|
|
|
|
|
2014-12-10 11:59:17 +08:00
|
|
|
#define LOCKED_OP_UPDATE "update"
|
|
|
|
#define LOCKED_OP_DELETE "delete"
|
|
|
|
|
|
|
|
typedef struct _LockedFile {
|
|
|
|
char *operation;
|
|
|
|
gint64 old_mtime;
|
|
|
|
char file_id[41];
|
|
|
|
} LockedFile;
|
|
|
|
|
|
|
|
typedef struct _LockedFileSet {
|
|
|
|
SeafRepoManager *mgr;
|
|
|
|
char repo_id[37];
|
|
|
|
GHashTable *locked_files;
|
|
|
|
} LockedFileSet;
|
|
|
|
|
|
|
|
LockedFileSet *
|
|
|
|
seaf_repo_manager_get_locked_file_set (SeafRepoManager *mgr, const char *repo_id);
|
|
|
|
|
|
|
|
void
|
|
|
|
locked_file_set_free (LockedFileSet *fset);
|
|
|
|
|
|
|
|
int
|
|
|
|
locked_file_set_add_update (LockedFileSet *fset,
|
|
|
|
const char *path,
|
|
|
|
const char *operation,
|
|
|
|
gint64 old_mtime,
|
|
|
|
const char *file_id);
|
|
|
|
|
|
|
|
int
|
|
|
|
locked_file_set_remove (LockedFileSet *fset, const char *path, gboolean db_only);
|
|
|
|
|
|
|
|
LockedFile *
|
|
|
|
locked_file_set_lookup (LockedFileSet *fset, const char *path);
|
|
|
|
|
2014-12-18 18:00:53 +08:00
|
|
|
/* Folder Permissions. */
|
|
|
|
|
|
|
|
typedef enum FolderPermType {
|
|
|
|
FOLDER_PERM_TYPE_USER = 0,
|
|
|
|
FOLDER_PERM_TYPE_GROUP,
|
|
|
|
} FolderPermType;
|
|
|
|
|
|
|
|
typedef struct _FolderPerm {
|
|
|
|
char *path;
|
|
|
|
char *permission;
|
|
|
|
} FolderPerm;
|
|
|
|
|
|
|
|
void
|
|
|
|
folder_perm_free (FolderPerm *perm);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_update_folder_perms (SeafRepoManager *mgr,
|
|
|
|
const char *repo_id,
|
|
|
|
FolderPermType type,
|
|
|
|
GList *folder_perms);
|
|
|
|
|
|
|
|
GList *
|
|
|
|
seaf_repo_manager_load_folder_perms (SeafRepoManager *mgr,
|
|
|
|
const char *repo_id,
|
|
|
|
FolderPermType type);
|
|
|
|
|
|
|
|
int
|
|
|
|
seaf_repo_manager_update_folder_perm_timestamp (SeafRepoManager *mgr,
|
|
|
|
const char *repo_id,
|
|
|
|
gint64 timestamp);
|
|
|
|
|
|
|
|
gint64
|
|
|
|
seaf_repo_manager_get_folder_perm_timestamp (SeafRepoManager *mgr,
|
|
|
|
const char *repo_id);
|
|
|
|
|
2012-07-27 19:47:42 +08:00
|
|
|
#endif
|