ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
service_session_service Class Reference

Service for managing service account sessions. More...

#include <service_session_service.hpp>

Collaboration diagram for service_session_service:
Collaboration graph

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::sessionstart_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::sessionstart_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::accountget_service_account (const std::string &username)
 Looks up a service account by username.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ service_session_service()

service_session_service ( context  ctx)
explicit

Constructs a service_session_service with required repositories.

Parameters
ctxDatabase context for persistence operations.

Member Function Documentation

◆ start_service_session() [1/2]

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.

Parameters
usernameThe username of the service account.
client_identifierThe client identifier (e.g., "ores.service.binary").
protocolThe session protocol (binary or http).
Returns
The created session if successful, nullopt if account not found or account is not a service account.
Here is the caller graph for this function:

◆ start_service_session() [2/2]

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.

Parameters
account_idThe UUID of the service account.
client_identifierThe client identifier.
protocolThe session protocol.
Returns
The created session if successful, nullopt if account not found or account is not a service account.

◆ end_service_session()

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.

Parameters
session_idThe UUID of the session to end.
start_timeThe session start time (required for TimescaleDB lookup).
bytes_sentFinal bytes sent count (default 0).
bytes_receivedFinal bytes received count (default 0).

◆ get_service_account()

std::optional< domain::account > get_service_account ( const std::string &  username)

Looks up a service account by username.

Parameters
usernameThe username to look up.
Returns
The account if found and is a service account, nullopt otherwise.
Here is the caller graph for this function: