overview/adr-provs/quasi-idempotence.md

35 lines
1.8 KiB
Markdown
Raw Normal View History

2021-11-30 17:49:07 +00:00
# Quasi idempotence
Idempotence means you can execute a function multiple times and always get the same result.
In real world idempotence typically is difficult because of three aspects:
1. Equality hard to define
2. There are unreflected changes in functions input
3. Function has side effects
For intentionally side effect executing functions we introduce "quasi idempotence". To avoid ambiguousness we have to define on which attribute we recognize former executions.
## Status
Approved.
## Context
Software installation with provs. In case of temporal broken external dependencies we want to be able to do another installation over the previous partially broken one.
We follow the principle "build from scratch", so we leave the question of software version updates unconsidered here.
## Consequence
1. add / change (a line) in existing files
2021-11-30 17:51:24 +00:00
* Solution: Query for changed location respecting the file type / format and skip if it was already performed. We try to avoid this case and use separate files instead of modifying existing ones.
2021-11-30 17:49:07 +00:00
2. installation of an single / directory file
2021-11-30 17:51:24 +00:00
* Solution: If the file/directory exists, we consider installation successful and skip this step in another installation run
2021-11-30 17:49:07 +00:00
3. installation of many files/directories
2021-11-30 17:51:24 +00:00
* Solution: If the last file/directory exists, we consider installation successful and skip this step in another installation run - this is useful in order to skip time consuming steps. For fast / trivial steps we can choose solution 2.
2021-11-30 17:49:07 +00:00
4. install apt/deb package
2021-11-30 17:51:24 +00:00
* Solution: Query whether package (name without version) is installed (either implicitly e.g. in case of apt or explicitly in other cases to avoid unnecessary downloads etc)
2021-11-30 17:49:07 +00:00
5. running docker containers
2021-11-30 17:51:24 +00:00
* Solution: Query whether container with name (we have to provide the name on container start) is already running