aboutsummaryrefslogtreecommitdiff
path: root/src/zencore
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-11-21 15:06:25 +0100
committerGitHub <[email protected]>2023-11-21 15:06:25 +0100
commit05178f7c18a48b21b9e260de282a86b91df26955 (patch)
tree25f77af287730c6dbe8d655e0cb503f2652cbd36 /src/zencore
parentzen run command (#552) (diff)
downloadzen-05178f7c18a48b21b9e260de282a86b91df26955.tar.xz
zen-05178f7c18a48b21b9e260de282a86b91df26955.zip
compact separate for gc referencer (#533)
- Refactor GCV2 so GcReferencer::RemoveExpiredData returns a store compactor, moving out the actual disk work from deleting items in the index. - Refactor GCV2 GcResult to reuse GcCompactStoreStats and GcStats - Make Compacting of stores non-parallell to not eat all the disk I/O when running GC
Diffstat (limited to 'src/zencore')
-rw-r--r--src/zencore/include/zencore/compactbinarybuilder.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/compactbinarybuilder.h b/src/zencore/include/zencore/compactbinarybuilder.h
index 9cb8f7193..dcb767d96 100644
--- a/src/zencore/include/zencore/compactbinarybuilder.h
+++ b/src/zencore/include/zencore/compactbinarybuilder.h
@@ -655,6 +655,24 @@ operator<<(CbWriter& Writer, const Oid& Value)
ZENCORE_API CbWriter& operator<<(CbWriter& Writer, DateTime Value);
ZENCORE_API CbWriter& operator<<(CbWriter& Writer, TimeSpan Value);
+ZENCORE_API inline TimeSpan
+ToTimeSpan(std::chrono::seconds Secs)
+{
+ return TimeSpan(0, 0, gsl::narrow<int>(Secs.count()));
+};
+ZENCORE_API inline TimeSpan
+ToTimeSpan(std::chrono::milliseconds MS)
+{
+ return TimeSpan(MS.count() * TimeSpan::TicksPerMillisecond);
+}
+ZENCORE_API inline DateTime
+ToDateTime(std::chrono::system_clock::time_point TimePoint)
+{
+ time_t Time = std::chrono::system_clock::to_time_t(TimePoint);
+ tm UTCTime = *gmtime(&Time);
+ return DateTime(1900 + UTCTime.tm_year, UTCTime.tm_mon, UTCTime.tm_mday, UTCTime.tm_hour, UTCTime.tm_min, UTCTime.tm_sec);
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void usonbuilder_forcelink(); // internal