From 806623c80dd11438ad916b6bba47d0e84f6c218e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 8 Aug 2018 19:27:58 +0200 Subject: [PATCH] Extend API documentation --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/README.md b/README.md index 49574fc..be9b156 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,8 @@ APIs exposed by our pre-witten event handlers are documented here. ### IdeEventHandler +This event handler is responsible for reading and writing files shown in the frontend code editor. + You can read the content of the currently selected file like so: ``` { @@ -184,6 +186,8 @@ Overwriting the current list of excluded file patterns is possible with this mes ### TerminalEventHandler +Event handler responsible for running a backend for `xterm.js` to connect to (frontend terminal backend). + By default callbacks on terminal history are invoked *as soon as* a command starts to execute in the terminal (they do not wait for the started command to finish, the callback may even run in paralell with the command). If you want to wait for them and invoke your callbacks *after* the command has finished, please set the `TFW_DELAY_HISTAPPEND` envvar to `1`. @@ -217,6 +221,8 @@ You can read terminal command history like so: ### ProcessManagingEventHandler +This event handler is responsible for managing processes controlled by supervisord. + Starting, stopping and restarting supervisor processes can be done using similar messages (where `command` is `start`, `stop` or `restart`): ``` { @@ -231,6 +237,8 @@ Starting, stopping and restarting supervisor processes can be done using similar ### LogMonitoringEventHandler +Event handler emitting real time logs (`stdout` and `stderr`) from supervisord processes. + To change which supervisor process is monitored use this message: ``` { @@ -257,6 +265,8 @@ To set the tail length of logs (the monitor will send back the last `value` char ### FSMManagingEventHandler +This event handler controls the TFW finite state machine (FSM). + To attempt executing a trigger on the FSM use (this will also generate an FSM update message): ``` { @@ -292,3 +302,41 @@ This event handler broadcasts FSM update messages after handling commands in the } ``` +### DirectorySnapshottingEventHandler + +Event handler capable of taking and restoring snapshots of directories (saving and restoring directory contens). + +You can take a snapshot of the directories with the following message: +``` +{ + "key": "snapshot", + "data" : + { + "command": "take_snapshot" + } +} +``` + +To restore the state of the files in the directories use: +``` +{ + "key": "snapshot", + "data" : + { + "command": "restore_snapshot", + "value": ...date string (can parse ISO 8601, unix timestamp, etc.)... + } +} +``` + +It is also possible to exclude files that match given patterns (formatted like lines in `.gitignore` files): +``` +{ + "key": "snapshot", + "data" : + { + "command": "exclude", + "value": ...list of patterns to exclude from snapshots... + } +} +```