1 #ifndef SEAF_WT_MONITOR_H 2 #define SEAF_WT_MONITOR_H 3 4 #include "wt-monitor-structs.h" 5 #include "utils.h" 6 7 typedef struct SeafWTMonitorPriv SeafWTMonitorPriv; 8 9 struct _SeafileSession; 10 11 typedef enum CommandType { 12 CMD_ADD_WATCH, 13 CMD_DELETE_WATCH, 14 CMD_REFRESH_WATCH, 15 N_CMD_TYPES, 16 } CommandType; 17 18 typedef struct WatchCommand { 19 CommandType type; 20 char repo_id[37]; 21 char worktree[SEAF_PATH_MAX]; 22 } WatchCommand; 23 24 typedef struct SeafWTMonitor { 25 struct _SeafileSession *seaf; 26 SeafWTMonitorPriv *priv; 27 28 seaf_pipe_t cmd_pipe[2]; 29 seaf_pipe_t res_pipe[2]; 30 31 /* platform dependent virtual functions */ 32 void* (*job_func) (void *); 33 } SeafWTMonitor; 34 35 SeafWTMonitor * 36 seaf_wt_monitor_new (struct _SeafileSession *seaf); 37 38 int 39 seaf_wt_monitor_start (SeafWTMonitor *monitor); 40 41 int 42 seaf_wt_monitor_watch_repo (SeafWTMonitor *monitor, 43 const char *repo_id, 44 const char *worktree); 45 46 int 47 seaf_wt_monitor_unwatch_repo (SeafWTMonitor *monitor, const char *repo_id); 48 49 int 50 seaf_wt_monitor_refresh_repo (SeafWTMonitor *monitor, const char *repo_id); 51 52 WTStatus * 53 seaf_wt_monitor_get_worktree_status (SeafWTMonitor *monitor, 54 const char *repo_id); 55 56 #endif 57