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

Snitch lib #590

Merged
merged 42 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d72d066
infra for snitch lib
jbbjarnason Jun 13, 2024
2e9ae5d
infra for snitch lib
jbbjarnason Jun 13, 2024
e5fbb90
compile time checks for snitch client and runtime where relevant
jbbjarnason Jun 18, 2024
534d7fb
add api types for listalarms and listactivations
jbbjarnason Jun 18, 2024
f622d87
list of api methods in header
jbbjarnason Jun 18, 2024
721e8b1
using 64 bit int for alarm id
jbbjarnason Jun 18, 2024
41562e8
add sdbusplus to cmake target
jbbjarnason Jun 18, 2024
73e0e95
renamed file
jbbjarnason Jun 18, 2024
57f1df0
Themis impl (#589)
Jun 18, 2024
53fbcc4
add class functions in source file
jbbjarnason Jun 18, 2024
4faefa3
Added register alarm, fetch alarms and register translation
Jun 18, 2024
5c18d42
Database design modified all alarm text moved to translation
Jun 18, 2024
ad0556f
Inital formatting complete
Jun 19, 2024
85a1d07
Fixed ordering of list_alarms, added spanish variable test
Jun 19, 2024
912e62f
Dbus interface outlines added
Jun 20, 2024
8652b7e
Align code better to documentation, update documentation, remove ack
Jun 20, 2024
ce41d59
Typo
Jun 20, 2024
d73c570
Added some basics of monitoring for a process that is lost.
Jun 20, 2024
5e7acdc
fill in the blanks of alarm dbus client
jbbjarnason Jun 20, 2024
18e00e7
alarm client wip
jbbjarnason Jun 20, 2024
1fb0768
Modify the reset behaviour to work on the same activation, Dont know …
Jun 20, 2024
94c5beb
Added some correctness checks
Jun 20, 2024
0c5c718
implement set and reset for snitch
jbbjarnason Jun 21, 2024
058f680
Updated policy and added tests
Jun 21, 2024
d0ab385
move implementation to source file
jbbjarnason Jun 21, 2024
52e83e3
set now with callback when finished
jbbjarnason Jun 21, 2024
d8b5364
minor
jbbjarnason Jun 21, 2024
aa242dc
alarm id and activation id getter aswell as watch daemon alive state
jbbjarnason Jun 21, 2024
5da4ed6
retry set as quickly as when alarm id is known
jbbjarnason Jun 21, 2024
568efc9
Added skeleton for integration test
Jun 21, 2024
ceae135
comment line which broke the code
jbbjarnason Jun 21, 2024
8cc0053
reset with callable and fix dbus arg matcher
jbbjarnason Jun 21, 2024
22cc7db
Some basic tests working
Jun 21, 2024
65ed3fd
Added some integration tests
Jun 21, 2024
b730de6
set alarm without callable when finished
jbbjarnason Jun 24, 2024
ddd844b
minor cleanup and get things compiling
jbbjarnason Jun 24, 2024
86c2c13
add test for invalid alarm set
jbbjarnason Jun 24, 2024
29086ca
formatting and adding test with arguments
jbbjarnason Jun 24, 2024
aadff4e
Added two failing tests
Jun 24, 2024
99acdce
:art: Committing clang-format changes
omarhogni Jun 24, 2024
a193dbb
Added functionality where services disapeared get their alarms marked…
Jun 24, 2024
4eae243
:art: Committing clang-format changes
omarhogni Jun 24, 2024
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
12 changes: 7 additions & 5 deletions docs/design/snitch.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ dynamic variable count must be the same.
The alarm system is exposed through the `com.skaginn3x.Alarm` interface.

### Methods
RegisterAlarm (s: alarm_name, i: alarm_level, b: non_latching) -> i: alarm_id Note errors can only be latched
RegisterAlarm (s: tfc_id, i: alarm_level, b: latching) -> i: alarm_id Note errors can only be latched
# ListAlarms returns boolean true in_locale if translation exists otherwise english
ListAlarms () -> s -> json of: std::vector<struct { string description; string details; bool latching; enum alarm_level; std::map<locale, struct translations{ string description; string details}> ; }>
# Note active = -1 for all, alarm_level = -1 for all a max size of 100 alarms will be sent at a time
ListActivations (s: locale, i: start_count, i: count, i: alarm_level, i: active, x: startunixTimestamp, x: endUnixTimestamp) -> s -> json of: struct { string description; string details; bool latching; enum alarm_level; bool active; std::uint64_t millisec_from_epoch; };
SetAlarm(i: alarm_id, as: variables)
ResetAlarm(i: alarm_id)
AckAlarm(i: alarm_id)
AckAllAlarms()
TryReset(i: alarm_id) # Transmits a signal to the alarm to reset itself
TryResetAll() # Transmits a signal to all alarms to reset themselfs
### Signals
AlarmChanged(i: alarm_id, b: current_activation, b: ack_status)
AlarmActivationChanged(i: alarm_id, b: current_activation)
TryReset(i: alarm_id)
TryResetAll()
### Properties
As of now there are no properties
## Database schema
Expand Down Expand Up @@ -58,7 +60,7 @@ Alarm variables
## Policy
Executables must register their alarms on construction. Unregistered alarms cannot be notified.

Once an alarm is registered the Alarm with Themis he will monitor the NameLost signal for the
Once an alarm is registered the Alarm with Themis he will monitor the NameOwnerChanged signal for the
name that registered the alarm. If the name is lost the alarm will be deactivated.

If an alarm is registered having changed the level or latching attributes the alarm shall be
Expand Down
3 changes: 2 additions & 1 deletion exes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ add_subdirectory(operations)
add_subdirectory(tfcctl)
add_subdirectory(ipc-ruler)
add_subdirectory(signal_source)
add_subdirectory(mqtt-bridge)
add_subdirectory(mqtt-bridge)
add_subdirectory(themis)
58 changes: 58 additions & 0 deletions exes/themis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
project(themis)
add_executable(themis src/main.cpp)

find_package(Boost REQUIRED COMPONENTS program_options)

find_package(PkgConfig REQUIRED)
pkg_check_modules(SDBUSPLUS REQUIRED IMPORTED_TARGET GLOBAL sdbusplus)

find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(OpenSSL CONFIG REQUIRED)

find_path(SQLITE_MODERN_CPP_INCLUDE_DIRS "sqlite_modern_cpp.h")
target_include_directories(themis
PRIVATE
$<BUILD_INTERFACE:${SQLITE_MODERN_CPP_INCLUDE_DIRS}>
PUBLIC
inc
)

target_link_libraries(themis
PUBLIC
tfc::ipc
tfc::base
tfc::confman
tfc::logger
tfc::dbus_util
tfc::snitch
Boost::program_options
PkgConfig::SDBUSPLUS
unofficial::sqlite3::sqlite3
OpenSSL::Crypto
)

add_subdirectory(tests)

include(tfc_split_debug_info)
tfc_split_debug_info(themis)

include(GNUInstallDirs)

install(
TARGETS
themis
DESTINATION
${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS Release
)

install(
TARGETS
themis
DESTINATION
${CMAKE_INSTALL_BINDIR}/debug/
CONFIGURATIONS Debug
)

include(tfc_systemd)
tfc_systemd_service_file(themis "TFC themis - alarm system")
Loading
Loading