diff options
Diffstat (limited to 'ext/lmdb-safe')
-rw-r--r-- | ext/lmdb-safe/lmdb-safe.cc | 7 | ||||
-rw-r--r-- | ext/lmdb-safe/lmdb-safe.hh | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ext/lmdb-safe/lmdb-safe.cc b/ext/lmdb-safe/lmdb-safe.cc index 33c3d45..6729286 100644 --- a/ext/lmdb-safe/lmdb-safe.cc +++ b/ext/lmdb-safe/lmdb-safe.cc @@ -68,12 +68,17 @@ namespace LMDBLS { return (lsh->d_flags & LS_FLAG_DELETED) != 0; } + uint64_t LSgetTimestamp(std::string_view val) { + const LSheader* lsh = LSassertFixedHeaderSize(val); + + return lsh->getTimestamp(); + } bool s_flag_deleted{false}; } #endif /* #ifndef DNSDIST */ -MDBDbi::MDBDbi(MDB_env* env, MDB_txn* txn, const string_view dbname, int flags) +MDBDbi::MDBDbi(MDB_env* /* env */, MDB_txn* txn, const string_view dbname, int flags) : d_dbi(-1) { // A transaction that uses this function must finish (either commit or abort) before any other transaction in the process may use this function. diff --git a/ext/lmdb-safe/lmdb-safe.hh b/ext/lmdb-safe/lmdb-safe.hh index 2d5983b..1c62d88 100644 --- a/ext/lmdb-safe/lmdb-safe.hh +++ b/ext/lmdb-safe/lmdb-safe.hh @@ -140,7 +140,9 @@ namespace LMDBLS { return std::string((char*)this, sizeof(*this)) + std::string(ntohs(d_numextra)*8, '\0'); } - + uint64_t getTimestamp() const { + return _LMDB_SAFE_BSWAP64MAYBE(d_timestamp); + } }; static_assert(sizeof(LSheader)==24, "LSheader size is wrong"); @@ -154,6 +156,7 @@ namespace LMDBLS { size_t LScheckHeaderAndGetSize(std::string_view val, size_t datasize=0); size_t LScheckHeaderAndGetSize(const MDBOutVal *val, size_t datasize=0); bool LSisDeleted(std::string_view val); + uint64_t LSgetTimestamp(std::string_view val); extern bool s_flag_deleted; } |