Transaction timestamp accessor
This commit is contained in:
parent
968d2d008c
commit
16e927034e
3 changed files with 18 additions and 2 deletions
|
@ -79,6 +79,11 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
auto timestamp () const
|
||||
{
|
||||
return txn.timestamp ();
|
||||
}
|
||||
|
||||
// Conversion operator to const nano::store::transaction&
|
||||
operator const nano::store::transaction & () const override
|
||||
{
|
||||
|
@ -118,6 +123,11 @@ public:
|
|||
txn.refresh_if_needed (max_age);
|
||||
}
|
||||
|
||||
auto timestamp () const
|
||||
{
|
||||
return txn.timestamp ();
|
||||
}
|
||||
|
||||
// Conversion operator to const nano::store::transaction&
|
||||
operator const nano::store::transaction & () const override
|
||||
{
|
||||
|
|
|
@ -38,6 +38,11 @@ auto nano::store::transaction::epoch () const -> epoch_t
|
|||
return current_epoch;
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::time_point nano::store::transaction::timestamp () const
|
||||
{
|
||||
return start;
|
||||
}
|
||||
|
||||
/*
|
||||
* read_transaction
|
||||
*/
|
||||
|
|
|
@ -43,10 +43,13 @@ public:
|
|||
virtual ~transaction () = default;
|
||||
virtual void * get_handle () const = 0;
|
||||
virtual nano::id_dispenser::id_t store_id () const = 0;
|
||||
|
||||
epoch_t epoch () const;
|
||||
std::chrono::steady_clock::time_point timestamp () const;
|
||||
|
||||
protected:
|
||||
epoch_t current_epoch{ 0 };
|
||||
std::chrono::steady_clock::time_point start{};
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -67,7 +70,6 @@ public:
|
|||
|
||||
private:
|
||||
std::unique_ptr<read_transaction_impl> impl;
|
||||
std::chrono::steady_clock::time_point start;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -89,6 +91,5 @@ public:
|
|||
|
||||
private:
|
||||
std::unique_ptr<write_transaction_impl> impl;
|
||||
std::chrono::steady_clock::time_point start;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue