(sat_ids.
empty()) {
75 for(
const auto& sat_id : sat_ids) {
77 stringsat_dbi =
string(
"#DATA[") + to_string(sat_id) +
"]";
91 ERR_POST(
Warning<<
"BlobProp cache: failed to open "<< sat_dbi <<
" dbi: "<< e.
what()
92<<
", cache for sat = "<< sat_id <<
" will not be used.");
97 ERR_POST(
Warning<<
"BlobProp cache: database disabled (#STATUS["<< sat_id <<
"][\"DISABLED\"] == \"yes\" OR #STATUS[" 98<< sat_id <<
"] does not exist) for "<< sat_dbi <<
", cache for sat = "<< sat_id <<
" will not be used.");
100 if(
static_cast<size_t>(sat_id) >
m_Dbis.size()) {
103 m_Dbis.push_back(std::move(pdbi));
110::psg::retrieval::BlobPropValue
info;
132 stringsat_dbi =
string(
"#STATUS[") + to_string(sat) +
"]";
147 value.assign_to(option_value);
148 returnoption_value !=
"yes";
164vector<CBlobRecord> response;
171 autosat = request.
GetSat();
172 if(!
m_Env|| sat < 0 ||
static_cast<size_t>(sat) >=
m_Dbis.size() || !
m_Dbis[sat]) {
185 while(has_current) {
189|| memcmp(
key.data<
const char>(), filter.c_str(), filter.size()) != 0
194has_current =
UnpackKey(
key.data<
const char>(),
key.size(), last_modified);
195 if(has_current && (!with_modified || last_modified == request.
GetLastModified())) {
196response.resize(response.size() + 1);
197 auto& last_record = response[response.size() - 1];
198last_record.SetKey(sat_key);
199last_record.SetModified(last_modified);
202response.resize(response.size() - 1);
214vector<CBlobRecord> response;
218 autosat = request.
GetSat();
219 if(!
m_Env|| sat < 0 ||
static_cast<size_t>(sat) >=
m_Dbis.size() || !
m_Dbis[sat]) {
227 while(has_current) {
233has_current =
UnpackKey(
key.data<
const char>(),
key.size(), last_modified, sat_key);
235response.resize(response.size() + 1);
236 auto& last_record = response[response.size() - 1];
237last_record.SetKey(sat_key);
238last_record.SetModified(last_modified);
241response.resize(response.size() - 1);
252 if(
m_Env&& sat >= 0 &&
static_cast<size_t>(sat) <
m_Dbis.size() &&
m_Dbis[sat])
258 while(has_current) {
262&&
UnpackKey(
key.data<
const char>(),
key.size(), last_modified, sat_key)
264 boolmore = fn(sat_key, last_modified);
297last_modified = -last_modified;
307last_modified = -last_modified;
#define BEGIN_IDBLOB_SCOPE
CBlobRecord::TSatKey GetSatKey() const
CBlobRecord::TTimestamp GetLastModified() const
bool HasField(EFields field) const
CBlobRecord & SetNChunks(int32_t value)
CBlobRecord & SetId2Info(string const &value)
CBlobRecord & SetHupDate(TTimestamp value)
CBlobRecord & SetDiv(string value)
CBlobRecord & SetDateAsn1(TTimestamp value)
CBlobRecord & SetSize(TSize value)
CBlobRecord & SetFlags(TBlobFlagBase value)
CBlobRecord & SetSizeUnpacked(TSize value)
CBlobRecord & SetClass(int16_t value)
CBlobRecord & SetUserName(string value)
CBlobRecord & SetOwner(int32_t value)
unique_ptr< lmdb::env > m_Env
CLMDBReadOnlyTxn BeginReadTxn()
void EnumerateBlobProp(int32_t sat, TBlobPropEnumerateFn fn)
function< bool(int32_t, int64_t)> TBlobPropEnumerateFn
static bool UnpackKey(const char *key, size_t key_sz, int64_t &last_modified)
bool x_ExtractRecord(CBlobRecord &record, lmdb::val const &value) const
vector< unique_ptr< lmdb::dbi, function< void(lmdb::dbi *)> > > m_Dbis
~CPubseqGatewayCacheBlobProp() override
bool x_CanOpenSatDatabase(int32_t sat, CLMDBReadOnlyTxn &rtxn)
static string PackKey(int32_t sat_key)
vector< CBlobRecord > FetchLast(CBlobFetchRequest const &request)
vector< CBlobRecord > Fetch(CBlobFetchRequest const &request)
void Pack(string &value, TInt bytes) const
TInt Unpack(const char *key) const
static cursor open(MDB_txn *const txn, const MDB_dbi dbi)
Creates an LMDB cursor.
Resource class for `MDB_dbi` handles.
void close(MDB_env *const env)
Closes DB handle.
static dbi open(MDB_txn *const txn, const char *const name=nullptr, const unsigned int flags=default_flags)
Opens a database handle.
Base class for LMDB exception conditions.
virtual const char * what() const noexcept
Returns the underlying LMDB error code.
int code() const noexcept
Returns the underlying LMDB error code.
static void raise(const char *origin, int rc)
Throws an error based on the given LMDB return code.
Wrapper class for `MDB_val` structures.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Warning(CExceptionArgs_Base &args)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
#define MDB_NOTFOUND
key/data pair not found (EOF)
@ MDB_LAST
Position at last key/data item.
@ MDB_FIRST
Position at first key/data item.
@ MDB_NEXT
Position at next data item.
@ MDB_SET_RANGE
Position at first key greater than or equal to specified key.
@ MDB_GET_CURRENT
Return key/data at current cursor position.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
static constexpr const unsigned kPackedLastModifiedSize
static constexpr const unsigned kPackedKeySize
static constexpr const unsigned kPackedSatKeySize
CPubseqGatewayCacheUnpackBytes TUnpackBytes
BEGIN_IDBLOB_SCOPE USING_NCBI_SCOPE
CPubseqGatewayCachePackBytes TPackBytes
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4