NCBI C++ ToolKit
record.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: record.cpp 84737 2018-12-05 17:12:42Z saprykin $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * File Description:
27  *
28  * Blob storage: blob changelog record
29  */
30 
31 #include <ncbi_pch.hpp>
32 
34 
35 #include <string>
36 #include <sstream>
37 
38 #include <corelib/ncbitime.hpp>
39 
42 
45 
47 {
48  return sPartitionSize;
49 }
50 
52 {
54 }
55 
57 {
58  sTTL = value;
59 }
60 
62 {
63  return sTTL;
64 }
65 
67 {
68  time_t t = updated_time.ToUniversalTime().GetTimeT();
69  return CTime(t - (t % partition_seconds));
70 }
71 
74 {
75 }
76 
78  CBlobRecord::TSatKey sat_key,
79  CBlobRecord::TTimestamp last_modified,
81 )
82  : m_SatKey(sat_key)
83  , m_LastModified(last_modified)
84  , m_Operation(operation)
85  , m_UpdatedTime(CTime::eCurrent, CTime::eUTC)
86 {
87 }
88 
90 {
91  return m_SatKey;
92 }
93 
95 {
96  return m_LastModified;
97 }
98 
100 {
101  return m_Operation;
102 }
103 
105 {
106  return static_cast<TChangelogOperationBase>(m_Operation);
107 }
108 
110 {
111  return m_UpdatedTime;
112 }
113 
115 {
116  return GetUpdatedTimePartition(m_UpdatedTime, partition_seconds);
117 }
118 
119 
121 {
122  m_UpdatedTime = time;
123 }
124 
126 {
127  stringstream s;
128  s << "CBlobChangelogRecord" << endl
129  << "\tm_SatKey: " << m_SatKey << endl
130  << "\tm_LastModified: " << m_LastModified << endl
131  << "\tm_Operation: " << static_cast<TChangelogOperationBase>(m_Operation) << endl
132  << "\tm_UpdatedTime: " << m_UpdatedTime << endl;
133  return s.str();
134 }
135 
#define END_IDBLOB_SCOPE
Definition: IdCassScope.hpp:40
#define BEGIN_IDBLOB_SCOPE
Definition: IdCassScope.hpp:39
BEGIN_IDBLOB_SCOPE USING_NCBI_SCOPE
Definition: record.cpp:41
int8_t TChangelogOperationBase
Definition: record.hpp:44
TChangelogOperation
Definition: record.hpp:45
TChangelogOperationBase GetOperationBase() const
Definition: record.cpp:104
string ToString() const
Definition: record.cpp:125
CBlobRecord::TTimestamp m_LastModified
Definition: record.hpp:98
TChangelogOperation m_Operation
Definition: record.hpp:99
static uint64_t sPartitionSize
Definition: record.hpp:94
TChangelogOperation GetOperation() const
Definition: record.cpp:99
static uint64_t sTTL
Definition: record.hpp:95
static uint64_t GetTTL()
Definition: record.cpp:61
static CTime GetUpdatedTimePartition(CTime updated_time, uint64_t partition_seconds)
Definition: record.cpp:66
static void SetPartitionSize(uint64_t value)
Definition: record.cpp:51
CBlobRecord::TTimestamp GetLastModified() const
Definition: record.cpp:94
CBlobRecord::TSatKey GetSatKey() const
Definition: record.cpp:89
static void SetTTL(uint64_t value)
Definition: record.cpp:56
void SetUpdatedTime(CTime time)
Definition: record.cpp:120
static uint64_t GetPartitionSize()
Definition: record.cpp:46
CTime GetUpdatedTime() const
Definition: record.cpp:109
CBlobRecord::TSatKey m_SatKey
Definition: record.hpp:97
int64_t TTimestamp
Definition: blob_record.hpp:56
int32_t TSatKey
Definition: blob_record.hpp:54
CTime –.
Definition: ncbitime.hpp:296
char value[7]
Definition: config.c:431
CTime & ToUniversalTime(void)
Convert the time into universal (GMT/UTC) time.
Definition: ncbitime.hpp:2472
time_t GetTimeT(void) const
Get time in time_t format.
Definition: ncbitime.cpp:1395
operation
Bit operations.
Definition: bmconst.h:191
EIPRangeType t
Definition: ncbi_localip.c:101
Defines: CTimeFormat - storage class for time format.
unsigned __int64 uint64_t
Definition: stdint.h:136
Modified on Tue Dec 05 02:09:12 2023 by modify_doxy.py rev. 669887