Skip to content

Megakuul/Cthulhu

Repository files navigation

Cthulhu

Cthulhu Icon

This is just a proof of concept

Cloud based hypervisor system for juju controlled environments.

Development


Coding conventions


Style conventions

  1. Private stuff is written in camelCase
  2. Public stuff is written in PascalCase
  3. Constants & macros are written in SCREAMING_SNAKE_CASE
  4. Namespaces are written in snake_case
  5. Filenames are written in snake_case

Exception system (C++)

Components employ a top-level try-catch block that ensures proper cleanup and correct application exit. Critical errors intended to terminate the application can be thrown to the top level, while other errors are caught, handled at lower levels, and logged using the global logger object.

The top-level block also catches std::exception, but in most cases, a util::ComponentException should be thrown to indicate the component where the exception occurred.

Exceptions should only be rethrown when converting an exception from an external library into a util::ComponentException.

Dependency management


All build steps are managed by the bazel build tool. Other tools shall only be used as bazel plugin.

Go dependencies are managed in the go.mod file at the root of the project, this file is processed by gazelle to generate the required rules under the hood.

C++ dependencies are managed in the MODULE.bazel file at the root of the project.

Every component does have its own Bazel BUILD file.

C++ rules must be manually configured, for Go and Proto rules, bazel run //:gazelle can be used to generate the code automatically.

Completions / IntelliSense


GO

For Go development I suggest using the gopls lang-server and import the repository root. Then you should have completion over the whole project.

C++

For C++ development I recommend using clangd for intellisense / documentation. To generate the compile_commands.json file there are various options, I recommend to use this tool:

bazel-compile-commands

bazel-compile-commands releases

(In case std is by default not ++23, you can use this option to replace the std: bazel-compile-commands -R c++14=c++23 -R -fno-canonical-system-headers="")