diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index b010403..3b95b20 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -8,14 +8,14 @@ Here is a high-level overview of the codebase. - `build.rs`: permits to create shell completions and man pages on build. - `Cargo.toml`, `Cargo.lock`: manifest and dependencies. -- `config`: example / test configuration files. Look at the git history to discover more! -- `debian`: reaction.deb generation. -- `Makefile`: Makefile. I plan to remove this at some point. -- `release.py`: Build process for a release. I'd like to make it more modular, to permit to build specific parts only for example. +- `config`: example / test configuration files. Look at its git history to discover more. +- `Makefile`: Makefile. Resumes useful commands. +- `packaging`: Files useful for .deb and .tar generation. +- `release.py`: Build process for a release. Handles cross-compilation, .tar and .deb generation. ## Main source code -- `helpers_c`: C helpers. I wish to have special IP support in reaction and get rid of them. +- `helpers_c`: C helpers. I wish to have special IP support in reaction and get rid of them. See #79 and #116. - `tests`: Integration tests. For now they test basic reaction runtime behavior, persistance, and client-daemon communication. - `src`: The source code, here we go! @@ -49,23 +49,9 @@ Client code: `reaction show`, `reaction flush`, `reaction test-regex`. Daemon runtime structures and logic. -This code is mainly async, with the tokio runtime. +This code has async code, to handle input streams and communication with clients, using the tokio runtime. - `mod.rs`: daemon main function. Initializes all tasks, handles synchronization and quitting, etc. - `stream.rs`: Stream managers: start the stream `cmd` and dispatch its stdout lines to its Filter managers. -- `filter.rs`: Filter managers: handle lines, store matches, send logs to database and decide when to trigger actions. -- `action.rs`: Action managers: handle action triggers (*execs*), store & manage pending actions. +- `filter.rs`: Filter managers: handle lines, persistance, store matches and trigger actions. This is the main piece of runtime logic. - `socket.rs`: The socket task, responsible for communication with clients. -- `database`: The database thread. This is a sync thread, because it's somehow muuch faster. At startup it sends persisted matches to the Filter managers. Then it receives match/exec logs from the filters and persist them. - - `database/mod.rs`: Main logic. - - `database/lowlevel.rs`: Low-level implementation details (serialization / deserialization and size optimizations). - - `database/tests.rs`: Unit tests. - -## Migration from Go to Rust - -- `go.old/`: Go / v1 codebase. - -Those scripts are merged in a single-file executable by `release.py`: - -- `export-go-db/`: Go script to export the reaction-v1 database as JSON. -- `import-rust-db/`: Rust script to import the JSON export as a reaction-v2 database. diff --git a/Makefile b/Makefile index 52a3af8..3efd558 100644 --- a/Makefile +++ b/Makefile @@ -20,3 +20,6 @@ install: reaction install_systemd: install install -m644 packaging/reaction.service $(SYSTEMDDIR)/system/reaction.service sed -i 's#/usr/local/bin#$(DESTDIR)$(BINDIR)#' $(SYSTEMDDIR)/system/reaction.service + +release: + nix-shell release.py diff --git a/README.md b/README.md index 725e0d8..da20a16 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ make install_systemd Contributions are welcome. For any substantial feature, please file an issue first, to be assured that we agree on the feature, and to avoid unnecessary work. -I recommend reading [`ARCHITECTURE.md`](ARCHITECTURE.md) first. This is a tour of the codebase, which should save time to potential contributors. +I recommend reading [`ARCHITECTURE.md`](ARCHITECTURE.md) first. This is a tour of the codebase, which should save time to new contributors. ## Funding