Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial project architecture overview #35

Merged
merged 3 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,24 @@ See [the examples and demos](./demo/README.md) for more examples.
### Using in other languages

TL;DR: You get the C header file, a shared library object or a DLL file from the
[Testcontainers for C](./docs/c/README.md) module,
Then, you know the drill.
[Testcontainers for C](./docs/c/README.md) module.
Then, you can bind this native library in your project type.
It allows supporting many other languages that support using
native tooling via dynamically or statically linked libraries:

![Languages that can leverage Testcontainers for C](docs/images/supported-languages.png)

Disclaimer:
The schema above shows the most popular languages for Embedded systems,
based on the
[IEEE Spectrum 2021 Report](https://spectrum.ieee.org/top-programming-languages-2021)
and the [JetBrains 2021 Developer Ecosystem Survey for Embedded Software](https://www.jetbrains.com/lp/devecosystem-2021/embedded/).
More native languages exist and can be supported by Testcontainers Native.

Feel free to contribute examples or SDKs for the languages!
See the [Swift Solution Page](./docs/swift/README.md) for examples.
[Testcontainers Native Architecture](./docs/architecture/README.md)
describes how it can be done in principle.

## Credits

Expand Down
26 changes: 26 additions & 0 deletions docs/architecture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,29 @@
!!! note
This section is coming soon.
All contributions are welcome, just submit a pull request!

## Build Process

![Testcontainers Native Build Process](./images/build-process.png)

### Stage 1. Testcontainers for C shared library

The core `testcontainers-c` shared library is built with [Cgo](https://pkg.go.dev/cmd/cgo).
For that the `-buildmode=c-shared` is used in the Golang builder,
and it also receives a customized header so that the types can be mapped between C and Golang.
For that, we also have to flatten the structure and to switch the reference-based build process to fixed Objects stored in the Golang namespace, and C API
using unique object IDs.

### Stage 2. Language Bindings

Then, we build custom binding libraries, by using Testcontainers for C
as a static library that is bundled into the language specific libs.
This stage depends on the language and common practices there.

### Stage 3. Executable Code

Well, you build it.
From the previous stages,
you get a header file, binding libraries,
a shared library object or a DLL file from the [Testcontainers for C](./docs/c/README.md) module.
Then, you know the drill.
Binary file added docs/architecture/images/build-process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/supported-languages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading