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

Metadata for tracking instance tier location. More...

#include <hsm_types.h>

Collaboration diagram for kcenon::pacs::storage::tier_metadata:
Collaboration graph

Public Member Functions

auto age () const -> std::chrono::system_clock::duration
 Get the age of the instance (time since storage)
 
auto time_since_access () const -> std::chrono::system_clock::duration
 Get the time since last access.
 
auto should_migrate (const tier_policy &policy, storage_tier target_tier) const -> bool
 Check if instance is eligible for migration to a target tier.
 

Public Attributes

std::string sop_instance_uid
 SOP Instance UID of the DICOM instance.
 
storage_tier current_tier {storage_tier::hot}
 Current storage tier.
 
std::chrono::system_clock::time_point stored_at
 Timestamp when instance was stored.
 
std::optional< std::chrono::system_clock::time_point > last_accessed
 Timestamp of last access (retrieve operation) nullopt if never accessed after initial storage.
 
std::size_t size_bytes {0}
 Size of the instance in bytes.
 
std::string study_instance_uid
 Study Instance UID (for grouping migrations)
 
std::string series_instance_uid
 Series Instance UID (for grouping migrations)
 

Detailed Description

Metadata for tracking instance tier location.

Stores information about where an instance is stored and when it was last accessed, used for making migration decisions.

Definition at line 142 of file hsm_types.h.

Member Function Documentation

◆ age()

auto kcenon::pacs::storage::tier_metadata::age ( ) const -> std::chrono::system_clock::duration
inlinenodiscard

Get the age of the instance (time since storage)

Returns
Duration since the instance was stored
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 170 of file hsm_types.h.

170 {
171 return std::chrono::system_clock::now() - stored_at;
172 }
std::chrono::system_clock::time_point stored_at
Timestamp when instance was stored.
Definition hsm_types.h:150

References stored_at.

Referenced by time_since_access().

Here is the caller graph for this function:

◆ should_migrate()

auto kcenon::pacs::storage::tier_metadata::should_migrate ( const tier_policy & policy,
storage_tier target_tier ) const -> bool
inlinenodiscard

Check if instance is eligible for migration to a target tier.

Parameters
policyThe tier policy to check against
target_tierThe target tier for migration
Returns
true if instance should be migrated
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 192 of file hsm_types.h.

193 {
194 // Can only migrate to a "colder" tier
195 if (target_tier <= current_tier) {
196 return false;
197 }
198
199 // Check size threshold
200 if (size_bytes < policy.min_migration_size) {
201 return false;
202 }
203
204 auto time_inactive = time_since_access();
205
206 // Check if instance has been inactive long enough
208 target_tier == storage_tier::warm) {
209 return time_inactive >= policy.hot_to_warm;
210 }
211
213 target_tier == storage_tier::cold) {
214 return time_inactive >= policy.warm_to_cold;
215 }
216
217 // Hot directly to cold (must meet both thresholds)
219 target_tier == storage_tier::cold) {
220 return time_inactive >= (policy.hot_to_warm + policy.warm_to_cold);
221 }
222
223 return false;
224 }
@ hot
Hot tier - Recent, frequently accessed data (SSD/NVMe)
@ cold
Cold tier - Archive, rarely accessed data (S3/Glacier)
@ warm
Warm tier - Older, occasionally accessed data (HDD)
std::size_t size_bytes
Size of the instance in bytes.
Definition hsm_types.h:158
auto time_since_access() const -> std::chrono::system_clock::duration
Get the time since last access.
Definition hsm_types.h:178
storage_tier current_tier
Current storage tier.
Definition hsm_types.h:147

References kcenon::pacs::storage::cold, current_tier, kcenon::pacs::storage::hot, size_bytes, time_since_access(), and kcenon::pacs::storage::warm.

Here is the call graph for this function:

◆ time_since_access()

auto kcenon::pacs::storage::tier_metadata::time_since_access ( ) const -> std::chrono::system_clock::duration
inlinenodiscard

Get the time since last access.

Returns
Duration since last access, or age if never accessed
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 178 of file hsm_types.h.

179 {
180 if (last_accessed.has_value()) {
181 return std::chrono::system_clock::now() - *last_accessed;
182 }
183 return age();
184 }
std::optional< std::chrono::system_clock::time_point > last_accessed
Timestamp of last access (retrieve operation) nullopt if never accessed after initial storage.
Definition hsm_types.h:155
auto age() const -> std::chrono::system_clock::duration
Get the age of the instance (time since storage)
Definition hsm_types.h:170

References age(), and last_accessed.

Referenced by should_migrate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ current_tier

storage_tier kcenon::pacs::storage::tier_metadata::current_tier {storage_tier::hot}

◆ last_accessed

std::optional<std::chrono::system_clock::time_point> kcenon::pacs::storage::tier_metadata::last_accessed

Timestamp of last access (retrieve operation) nullopt if never accessed after initial storage.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 155 of file hsm_types.h.

Referenced by time_since_access().

◆ series_instance_uid

std::string kcenon::pacs::storage::tier_metadata::series_instance_uid

Series Instance UID (for grouping migrations)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 164 of file hsm_types.h.

Referenced by kcenon::pacs::storage::hsm_storage::update_metadata().

◆ size_bytes

std::size_t kcenon::pacs::storage::tier_metadata::size_bytes {0}

◆ sop_instance_uid

std::string kcenon::pacs::storage::tier_metadata::sop_instance_uid

◆ stored_at

std::chrono::system_clock::time_point kcenon::pacs::storage::tier_metadata::stored_at
Initial value:
{
std::chrono::system_clock::now()}

Timestamp when instance was stored.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 150 of file hsm_types.h.

150 {
151 std::chrono::system_clock::now()};

Referenced by age(), and kcenon::pacs::storage::hsm_storage::update_metadata().

◆ study_instance_uid

std::string kcenon::pacs::storage::tier_metadata::study_instance_uid

Study Instance UID (for grouping migrations)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/storage/hsm_types.h.

Definition at line 161 of file hsm_types.h.

Referenced by kcenon::pacs::storage::hsm_storage::update_metadata().


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