cli MVP
This commit is contained in:
parent
367c19386c
commit
1ea50c50bc
62 changed files with 9982 additions and 608 deletions
31
interfaces/Nostro-Daemon.cppm
Normal file
31
interfaces/Nostro-Daemon.cppm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||||
|
||||
export module Nostro:Daemon;
|
||||
#ifdef NOSTRO_DBUS_ENABLED
|
||||
|
||||
import std;
|
||||
|
||||
namespace Nostro {
|
||||
// How nostrod runs: where it keeps each user's connectors and transactions, and when it lets go.
|
||||
export struct DaemonOptions {
|
||||
// Each user's directory is users/<uid> below it.
|
||||
std::filesystem::path state;
|
||||
// A worker exits after this long without a call, and the front once no worker is left; the next call starts
|
||||
// them again, D-Bus activation the front.
|
||||
std::chrono::seconds idle{300};
|
||||
// How long a call waits for polkit, the user's password prompt included, before it is refused.
|
||||
std::chrono::seconds promptTimeout{300};
|
||||
};
|
||||
|
||||
// The front: owns net.catcrafts.Nostro1 on the system bus, works out each caller's uid, and hands every call to
|
||||
// that uid's worker, started on demand as a process of its own. It holds no connector itself. Returns 0 once it
|
||||
// was idle with no worker left or the bus went away, after it ended its workers. Throws when it cannot start.
|
||||
export std::int32_t RunDaemon(const DaemonOptions& options);
|
||||
|
||||
// A worker: the library for one user, `uid`, whom logind calls `name`, serving the front over the connected socket
|
||||
// `fd`. Every call is authorised with polkit before it runs. Returns 0 when it was idle or the front went away.
|
||||
export std::int32_t RunWorker(std::int32_t fd, std::uint32_t uid, std::string_view name, const DaemonOptions& options);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue