PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::workflow::lock_token Struct Reference

Unique identifier for a lock. More...

#include <study_lock_manager.h>

Collaboration diagram for kcenon::pacs::workflow::lock_token:
Collaboration graph

Public Member Functions

auto is_valid () const -> bool
 Check if the token is valid (not expired)
 
auto is_expired () const -> bool
 Check if the token has expired.
 
auto remaining_time () const -> std::optional< std::chrono::milliseconds >
 Get remaining time until expiration.
 

Public Attributes

std::string token_id
 Unique token ID.
 
std::string study_uid
 Study UID that is locked.
 
lock_type type {lock_type::exclusive}
 Type of lock held.
 
std::chrono::system_clock::time_point acquired_at
 When the lock was acquired.
 
std::optional< std::chrono::system_clock::time_point > expires_at
 When the lock expires (if timeout set)
 

Detailed Description

Unique identifier for a lock.

Definition at line 85 of file study_lock_manager.h.

Member Function Documentation

◆ is_expired()

auto kcenon::pacs::workflow::lock_token::is_expired ( ) const -> bool
inlinenodiscard

Check if the token has expired.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/workflow/study_lock_manager.h.

Definition at line 112 of file study_lock_manager.h.

112 {
113 return !is_valid();
114 }
auto is_valid() const -> bool
Check if the token is valid (not expired)

References is_valid().

Here is the call graph for this function:

◆ is_valid()

auto kcenon::pacs::workflow::lock_token::is_valid ( ) const -> bool
inlinenodiscard

Check if the token is valid (not expired)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/workflow/study_lock_manager.h.

Definition at line 104 of file study_lock_manager.h.

104 {
105 if (!expires_at) return true;
106 return std::chrono::system_clock::now() < *expires_at;
107 }
std::optional< std::chrono::system_clock::time_point > expires_at
When the lock expires (if timeout set)

References expires_at.

Referenced by is_expired().

Here is the caller graph for this function:

◆ remaining_time()

auto kcenon::pacs::workflow::lock_token::remaining_time ( ) const -> std::optional<std::chrono::milliseconds>
inlinenodiscard

Get remaining time until expiration.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/workflow/study_lock_manager.h.

Definition at line 119 of file study_lock_manager.h.

120 {
121 if (!expires_at) return std::nullopt;
122 auto now = std::chrono::system_clock::now();
123 if (now >= *expires_at) return std::chrono::milliseconds{0};
124 return std::chrono::duration_cast<std::chrono::milliseconds>(
125 *expires_at - now);
126 }

References expires_at.

Member Data Documentation

◆ acquired_at

std::chrono::system_clock::time_point kcenon::pacs::workflow::lock_token::acquired_at

◆ expires_at

std::optional<std::chrono::system_clock::time_point> kcenon::pacs::workflow::lock_token::expires_at

◆ study_uid

std::string kcenon::pacs::workflow::lock_token::study_uid

◆ token_id

std::string kcenon::pacs::workflow::lock_token::token_id

◆ type

lock_type kcenon::pacs::workflow::lock_token::type {lock_type::exclusive}

The documentation for this struct was generated from the following file: