diff options
author | 2022-09-10 12:15:20 -0400 | |
---|---|---|
committer | 2022-09-10 12:30:27 -0400 | |
commit | c52afaf8b5c96136fe20e5d5a1332121d3b09ee9 (patch) | |
tree | 4f749a779cdf92abb7e49fee7398b8e0e2ef852a /src/systemd_manager.h | |
parent | c675bafdf15cc19276bd8276c34f56404a5ecb62 (diff) |
Add gRPC API implementation
Changes:
- Rename the existing daemon to applaunchd-dbus, and add a new
version that exposes a gRPC based implementation of the API based
on the protobuf definition added in a top-level protos directory.
Having both the D-Bus and gRPC APIs exposed by a single daemon was
posing difficulties around startup dependencies stemming from D-Bus
activation of the daemon. Since the end goal is dropping the D-Bus
API entirely, it is easier to just add a second daemon for gRPC that
will eventually be the only one present.
- To facilitate building the two implementations, a significant amount
of code refactoring has been done to move things from the D-Bus API
implementing app_launcher.[ch] to systemd_manager.[ch] so the code
can be reused.
- All use of the systemd D-Bus library except for the path encoding
helper function has been replaced with GDBus. The systemd interface
wrapper code was generated with gdbus-codegen from XML files captured
via introspection on a running system. The motivation for this
change was to avoid multithreading issues with sd_bus exposed when
calling into it from the gRPC threads.
- The copyright headers in the source files have been tweaked to
remove the Apache license boilerplate in favour of a SPDX license
tag.
Notes:
- The gRPC API differs slightly from the D-Bus one in that it has a
single status streaming RPC method as opposed to the separate signals
for application started or terminated that the D-Bus API has.
- The gRPC API is currently unauthenticated, the aim is to circle back
and implement authentication once a consensus can be reached on what
mechanism should be used (fixed JWT configuration, OAuth, etc.).
Bug-AGL: SPEC-4559
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I828f38a58b60e9959162b98054982124d4fa4380
Diffstat (limited to 'src/systemd_manager.h')
-rw-r--r-- | src/systemd_manager.h | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/systemd_manager.h b/src/systemd_manager.h index b866948..b4c505a 100644 --- a/src/systemd_manager.h +++ b/src/systemd_manager.h @@ -1,17 +1,6 @@ +// SPDX-License-Identifier: Apache-2.0 /* * Copyright (C) 2022 Konsulko Group - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ #ifndef SYSTEMDMANAGER_H @@ -20,7 +9,6 @@ #include <glib-object.h> #include "app_info.h" -#include "app_launcher.h" G_BEGIN_DECLS @@ -29,20 +17,23 @@ G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(SystemdManager, systemd_manager, APPLAUNCHD, SYSTEMD_MANAGER, GObject); -SystemdManager *systemd_manager_new(void); +SystemdManager *systemd_manager_get_default(void); -gboolean systemd_manager_enumerate_app_units(SystemdManager *self, - AppLauncher *launcher, - GList **units); +void systemd_manager_connect_callbacks(SystemdManager *self, + GCallback started_cb, + GCallback terminated_cb, + void *data); -gboolean systemd_manager_get_app_description(SystemdManager *self, - AppLauncher *launcher, - gchar *service, - gchar **description); +AppInfo *systemd_manager_get_app_info(SystemdManager *self, + const gchar *app_id); + +GList *systemd_manager_get_app_list(SystemdManager *self); gboolean systemd_manager_start_app(SystemdManager *self, AppInfo *app_info); G_END_DECLS +void systemd_manager_free_runtime_data(gpointer data); + #endif |