|
ORE Studio 0.0.4
|
Service for managing service account sessions. More...
#include <service_session_service.hpp>

Public Types | |
| using | context = ores::database::context |
Public Member Functions | |
| service_session_service (context ctx) | |
| Constructs a service_session_service with required repositories. | |
| std::optional< domain::session > | start_service_session (const std::string &username, const std::string &client_identifier, domain::session_protocol protocol=domain::session_protocol::binary) |
| Starts a session for a service account. | |
| std::optional< domain::session > | start_service_session (const boost::uuids::uuid &account_id, const std::string &client_identifier, domain::session_protocol protocol=domain::session_protocol::binary) |
| Starts a session for a service account by account ID. | |
| void | end_service_session (const boost::uuids::uuid &session_id, const std::chrono::system_clock::time_point &start_time, std::uint64_t bytes_sent=0, std::uint64_t bytes_received=0) |
| Ends a service session. | |
| std::optional< domain::account > | get_service_account (const std::string &username) |
| Looks up a service account by username. | |
Service for managing service account sessions.
Service accounts (service, algorithm, llm) cannot login with passwords. They create sessions directly at startup and end them on shutdown. This service provides a simplified interface for managing these sessions.
|
explicit |
Constructs a service_session_service with required repositories.
| ctx | Database context for persistence operations. |
| std::optional< domain::session > start_service_session | ( | const std::string & | username, |
| const std::string & | client_identifier, | ||
| domain::session_protocol | protocol = domain::session_protocol::binary |
||
| ) |
Starts a session for a service account.
Creates a new session record for the specified service account. Service accounts are identified by username and must have a non-user account type.
| username | The username of the service account. |
| client_identifier | The client identifier (e.g., "ores.service.binary"). |
| protocol | The session protocol (binary or http). |

| std::optional< domain::session > start_service_session | ( | const boost::uuids::uuid & | account_id, |
| const std::string & | client_identifier, | ||
| domain::session_protocol | protocol = domain::session_protocol::binary |
||
| ) |
Starts a session for a service account by account ID.
| account_id | The UUID of the service account. |
| client_identifier | The client identifier. |
| protocol | The session protocol. |
| void end_service_session | ( | const boost::uuids::uuid & | session_id, |
| const std::chrono::system_clock::time_point & | start_time, | ||
| std::uint64_t | bytes_sent = 0, |
||
| std::uint64_t | bytes_received = 0 |
||
| ) |
Ends a service session.
Sets the end_time on the session record.
| session_id | The UUID of the session to end. |
| start_time | The session start time (required for TimescaleDB lookup). |
| bytes_sent | Final bytes sent count (default 0). |
| bytes_received | Final bytes received count (default 0). |
| std::optional< domain::account > get_service_account | ( | const std::string & | username | ) |
Looks up a service account by username.
| username | The username to look up. |
