Jeff Hostetler | d2bd862 | 2022-03-25 18:02:45 +0000 | [diff] [blame] | 1 | #ifndef FSMONITOR_IPC_H |
| 2 | #define FSMONITOR_IPC_H |
| 3 | |
| 4 | #include "simple-ipc.h" |
| 5 | |
Eric DeCosta | 6beb268 | 2022-10-04 17:32:27 +0000 | [diff] [blame] | 6 | struct repository; |
| 7 | |
Jeff Hostetler | d2bd862 | 2022-03-25 18:02:45 +0000 | [diff] [blame] | 8 | /* |
| 9 | * Returns true if built-in file system monitor daemon is defined |
| 10 | * for this platform. |
| 11 | */ |
| 12 | int fsmonitor_ipc__is_supported(void); |
| 13 | |
| 14 | /* |
| 15 | * Returns the pathname to the IPC named pipe or Unix domain socket |
| 16 | * where a `git-fsmonitor--daemon` process will listen. This is a |
| 17 | * per-worktree value. |
| 18 | * |
| 19 | * Returns NULL if the daemon is not supported on this platform. |
| 20 | */ |
Eric DeCosta | 6beb268 | 2022-10-04 17:32:27 +0000 | [diff] [blame] | 21 | const char *fsmonitor_ipc__get_path(struct repository *r); |
Jeff Hostetler | d2bd862 | 2022-03-25 18:02:45 +0000 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * Try to determine whether there is a `git-fsmonitor--daemon` process |
| 25 | * listening on the IPC pipe/socket. |
| 26 | */ |
| 27 | enum ipc_active_state fsmonitor_ipc__get_state(void); |
| 28 | |
| 29 | /* |
| 30 | * Connect to a `git-fsmonitor--daemon` process via simple-ipc |
| 31 | * and ask for the set of changed files since the given token. |
| 32 | * |
| 33 | * Spawn a daemon process in the background if necessary. |
| 34 | * |
| 35 | * Returns -1 on error; 0 on success. |
| 36 | */ |
| 37 | int fsmonitor_ipc__send_query(const char *since_token, |
| 38 | struct strbuf *answer); |
| 39 | |
| 40 | /* |
| 41 | * Connect to a `git-fsmonitor--daemon` process via simple-ipc and |
| 42 | * send a command verb. If no daemon is available, we DO NOT try to |
| 43 | * start one. |
| 44 | * |
| 45 | * Returns -1 on error; 0 on success. |
| 46 | */ |
| 47 | int fsmonitor_ipc__send_command(const char *command, |
| 48 | struct strbuf *answer); |
| 49 | |
| 50 | #endif /* FSMONITOR_IPC_H */ |